Over 220,000 provisional ballots have already been discounted in the presidential primaries this year, according to a survey by The Huffington Post, with many thousands more likely to be tossed as states finish certifying their primaries.

Congress passed the Help America Vote Act in 2002 after the disaster that was the 2000 presidential election. That legislation created “provisional ballots” (they are sometimes referred to as “affidavit” or “challenge” ballots) to act as a backup in case a poll worker cannot immediately establish a voter’s eligibility.

To determine how many people’s ballots didn’t count this year, HuffPost asked nearly every state that held a presidential primary this cycle how many provisional ballots were cast and how many of those provisional ballots were ultimately counted. Some states partially count ballots cast outside of the voter’s precinct by counting selections for state and federal offices, but not local races.

Here is a graphic showing what we found; it doesn’t include data from states where only a minuscule number of provisional ballots were recorded, like Vermont and Kentucky.

HuffPost got statewide data from 23 of the states that held primaries this year, plus data from Arizona’s largest county, Maricopa; data from Kansas, whose GOP caucus weirdly issues provisional ballots -- caucuses don’t typically involve ballots; and data from New York City, where the chaotic Democratic presidential primary resulted in an unusually high number of provisional ballots submitted and rejected. (Public affairs officials with the New York State Board of Elections ignored repeated emails and calls from HuffPost.)

The legislation that created provisional ballots has little guidance on what to do with the actual votes, so our survey could not be entirely comprehensive. Some states don’t collect provisional ballot data at the statewide level, so this survey does not include data from five states that redirected us to their counties: Arkansas, Connecticut, Florida, Tennessee and West Virginia. It is too soon to know how many provisional ballots were cast in states that held primaries in the last month, so it does not include data from Montana, New Jersey, New Mexico, South Dakota and the District of Columbia. In the nation’s most populous state, California, tens of thousands (if not hundreds of thousands) of provisional ballots have yet to be counted.

Provisional ballots were originally hailed as a way to ensure that eligible voters are not turned away from the polls due to administrative errors. But civil rights advocates increasingly worry that they are being distributed less as a backup for voters and more because of a wave of new restrictions on voting, including new voter identification laws. Various studies have shown that the casting of provisional ballots correlates with high shares of racial minorities and non-English speakers in a particular area.

The Election Assistance Commission says that the most common reasons for issuing a provisional ballot are if the voter’s name is not on the registration list; the voter’s eligibility cannot be established; the voter’s identity and/or eligibility to vote has been challenged by a poll worker or election official; the voter does not have the correct form of identification required by their state; the voter requested an absentee ballot but didn’t receive it or didn’t cast it; the voter’s address or name has changed but their voter registration information does not reflect the change; and, in primaries, if the voter’s registration reflects the wrong party listing.

The 24,630 provisional ballots cast in Maricopa County, Arizona, were due in large part to the nature of the state’s presidential primaries, which are closed to voters who are not registered with a particular political party. The Huffington Post talked to a number of supporters of Bernie Sanders, a Democratic presidential candidate, who showed up to the polls only to be forced to cast a provisional ballot that would ultimately not be counted, because they were not registered as Democrats. A subsequent investigation by the county revealed that 46 ballots out of the 4,631 provisional ballots that were counted were connected to voters who were mistakenly stripped of their party affiliation because of administrative errors.

Even though voters may have to jump through hoops to have their provisional ballot count, it’s still a good idea to cast a provisional ballot at the polls if filling out a regular one isn’t possible.

“People should not leave without casting a provisional, because it does provide documentation for voting rights experts, researchers and attorneys to see problems that people had and that evidence is used in court cases, which we have done,” said Bob Hall, the executive director of Democracy North Carolina, a voting rights group.

ASSOCIATED PRESS Voters cast their ballots in Columbus, Ohio, in the state's March 2016 presidential primary.

Hall pointed out that in North Carolina, a court injunction protected safety-net provisions like out-of-precinct voting that the Republican-controlled state legislature had previously eliminated in 2013. Civil rights groups filed multiple lawsuits over a law backed by Republicans that said ballots cast outside of a voter’s assigned precinct could no longer be partially counted for statewide and federal races. Their law also instituted a strict new photo ID requirement, cut back a week of early voting and eliminated same-day registration. Republicans said the restrictions were meant to prevent nearly nonexistent voter fraud while Democrats said they were meant to disenfranchise groups that typically vote for them, like racial minorities and students. A federal court of appeals will hold a hearing over one of those lawsuits on June 21.

In the state’s March presidential primaries, voters who showed up at the wrong precinct could still cast provisional ballots, so over 6,300 of those were counted fully or partially. The state modified its government-issued photo ID requirement to vote at the polls in 2015, so this spring, primary voters could sign an affidavit stating that they had a “reasonable impediment” that prevented them from acquiring a proper piece of ID. Out of 2,371 provisional ballots that were cast because of photo ID issues, 1,410 were rejected.

“The long and the short of it is that provisional ballots were used for people who didn’t have IDs and they were treated differently in different counties and even in the precincts by different poll workers,” Hall said. “The problem is inconsistency … The ID part has become quite complicated and has made the process more complex. It’s confusing to voters and to precinct officials and it leads to people being disenfranchised by human error. We have more disenfranchisement from human error from a more complex system than there ever was from fraud based on impersonation.”

In 2012, 2.7 million provisional ballots were cast -- up from 2.1 million in the 2008 presidential election -- with 24 percent of those ballots rejected. That number is sure to rise again in the general election later this year. While people often forget that provisional ballots exist, or are unfamiliar with how they work, they can make a difference in an especially close race.

It’s possible to make a provisional ballot transform from a temporary one to one that is counted, depending on your state’s laws, but as the graphic above shows, you should do everything within your power to cast a regular ballot in the general election.

There are measures states can implement to reduce the incidence of provisional ballots, including transferring to all vote-by-mail elections, like Colorado, Oregon and Washington, or implementing same-day registration, so eligible voters can update their registration information at the polls before they vote, if they’ve recently moved or have another registration issue.

Blair Guild and Robert Baldwin III contributed reporting.