As Donald Trump maintains his incendiary attacks on the legitimacy of the election, one of his favorite themes has been the claim that the results will be tainted by the votes of millions of people in the U.S. illegally.
"They are letting people pour into the country so they can go ahead and vote," he said this month, in a meeting with the head of the union representing border patrol agents.
"And believe me, there's a lot going on," Trump said at a rally. "People that have died 10 years ago are still voting. Illegal immigrants are voting."
Part of the Republican-led crackdown on supposed voter fraud, battles over measures to guard against noncitizen voters have percolated for years in election offices, state legislatures and federal courtrooms.
Records in these fights show that small numbers of noncitizens do end up registered, and a few have cast votes. However, no one has uncovered evidence of thousands of noncitizen voters — and no evidence has emerged to support Trump's theory of a coordinated effort to throw an election by stuffing the voting rolls with ineligible immigrants.
"What we have seen are errors," said Dale Ho, director of the voting rights project of the American Civil Liberties Union. "There's not a horde of people trying to break into this country so they can vote."
The rule on voting eligibility is simple: Except for a handful of cities that permit noncitizens to vote in local elections, everyone who casts a vote in America is supposed to be a citizen, either by birth or by naturalization. And although the distinction is sometimes lost in the loud debates over undocumented immigration, even green-card holders, who are legal permanent residents, also are ineligible to vote until they become citizens.
In most places in the U.S., the question is handled solely on the honor system. When people register to vote, they check a box attesting that they are U.S. citizens. Election administrators verify identity by looking at driver's license or Social Security numbers, for example, but under federal guidelines, they may not ask for proof of citizenship, such as a birth certificate or passport.
Four states — Arizona, Kansas, Georgia and Alabama — have passed their own citizenship verification rules, but those requirements have been tangled up for years in lawsuits by progressive and voting rights groups, who argue that they present an unfair burden on minority voters. Thus far, they have prevailed, although the battles continue.
Georgia and Alabama haven't been enforcing their requirements, but in the other two states, the fights over proving citizenship have led to unusual results. Arizona now recognizes a second class of voters — 6,328 for this election — who can vote for federal offices, like president, but not for the governor or other state offices, because they haven't provided proof of citizenship.
This month, a federal appeals court forced Kansas to accept the registrations of people who had signed up to vote at motor vehicle offices, without providing proof of citizenship. Emergency notices were mailed to these voters, telling them in all capitals to "PLEASE DISREGARD" prior warnings that they weren't eligible to vote.
But nearly 9,000 others, because they signed up using Kansas' own form, still are considered ineligible to vote in this election by state officials unless they come up with citizenship proof by election day, Nov. 8. County election officials have scrambled to keep up.
"It is a mess, and that's the predicament that the judge ultimately put the election system in," said Desiree Taliaferro, spokeswoman for Kansas Secretary of State Kris Kobach, who oversees elections. "It's crazy."
Another case on a similar issue is still pending in federal court in Washington, D.C.
Among the leaders of the conservative push for more citizenship checks is lawyer J. Christian Adams. While working at the civil rights section of the Department of Justice, he filed a voter intimidation case against two members of the New Black Panther Party in Philadelphia; when the department refused to prosecute most charges, the case became a favorite example among conservatives.
Now president of the conservative Public Interest Legal Foundation, Adams has pushed this year for measures to find and purge noncitizens from the voting rolls.
As one step, he's sought to show that it's too easy for noncitizens to register to vote. Eight Virginia counties provided records showing that more than 1,000 people had been removed from the rolls since 2011 because they were not citizens, the foundation said. In Philadelphia, a city that has been a focus of Trump's warnings of potential election fraud, 86 people were removed from the rolls after they turned out not to be citizens, and 40 of them voted at least once.
"These are only the people who are caught," Adams said. "It frightens me to think what the actual number is in Virginia. That's the problem here — there's no verification after the box gets checked."
The League of Women voters, progressive groups and others counter by saying that the document rules would unfairly keep out many legitimate voters to deter a few noncitizens.
"Most people see this for what it is: xenophobia masquerading as election integrity," said Ho of the ACLU.
One elections administrator in Philadelphia also blamed registration drives, where those hired to register voters can, perhaps inadvertently, mislead people who don't know the law.
Some prospective voters "are not proficient in the English language, and they're told out on the street, 'Yeah, you can register to vote, it's no problem,'" said Tim Dowling, deputy commissioner of elections. "If they check they're 18 and a U.S. citizen, we have to accept that. We err on the side of enfranchising the voter."
Past claims that large numbers of ineligible noncitizens are lurking on the voting rolls have fizzled. In 2012, Florida's Republican governor, Rick Scott, pushed for a purge of noncitizen voters. An initial list of 180,000 names was whittled to 2,600, then sent to county election supervisors to check. But the smaller list also turned out to be filled with errors, and in the end, only 85 people were removed from the rolls.
Trump has cited one study by three Virginia academics that estimated that more than 6% of noncitizens illegally voted in 2008 — enough to sway a close election, like the Senate race in Minnesota that year in which Al Franken was elected by a 312-vote margin.
The study arrived at the result by considering responses from a survey of voters, some of whom said they were not citizens. But the findings have been attacked by other researchers, who say they found evidence that many people gave wrong answers to the citizenship question — and that therefore the correct number of noncitizens who voted was probably zero.
In any case, experts say, it's unlikely that anyone could find enough noncitizens on the voter rolls to challenge the results in a typical presidential election. In 2012, President Obama won Pennsylvania by 310,000 votes and Virginia by 149,000. The closest margin was in Florida, where Obama won by 74,000 votes.
Illegal voting is rarely prosecuted, but it can have severe consequences. Someone in the country illegally who is caught voting would be declared ineligible to become a citizen and could even be deported.
Lori Edwards, elections supervisor in Polk County, Fla., said she rarely encountered such cases in the 16 years she's held the job.
"If you were here as an undocumented person, or even someone who has a green card," she asked, "why would you risk that status for what would be a minimal benefit?"