Nearly 90 percent of the provisional paper ballots cast by Long Islanders in last month’s presidential primary were not counted, primarily because voters missed a deadline to change their party registration, the Nassau and Suffolk boards of elections said.

More than 21,000 Long Island residents cast affidavit ballots given to voters when their names are not found on the rolls at their polling sites. Election commissioners then must determine if the ballot is valid and should be counted.

Board data show that nearly 87 percent of affidavit ballots cast in both counties during the April 19 primary — a total of 18,305 — were rejected. In a typical election around 25 percent of provisional ballots are counted, officials said.

Suffolk tallied 14,467 affidavit ballots during last month’s primary, but only 1,576, or about 11 percent, were counted, said Nicholas LaLota, the county’s GOP election commissioner.

In Nassau, 6,638 affidavit ballots were filled out. The board determined that 1,224 — 18 percent — were valid, said Democratic Elections Commissioner David Gugerty.

New York is one of 11 states with closed primary systems in which only registered party members can participate. Voters had to switch their party registrations by Oct. 9, 2015 — the nation’s earliest deadline — to vote in the New York primary. New voters had until March 25 to register.

advertisement | advertise on newsday

LaLota said Suffolk voters not registered as Democrats or Republicans “flooded the polls” to try to vote in the primary, likely for Sen. Bernie Sanders on the Democratic side or Republican businessman Donald Trump.

John Ryan, counsel to Nassau GOP Elections Commissioner Louis Savinetti, said many voters were unaware of the deadline, leading to a spike in affidavits. “It was very unusual,” Ryan said. “I’ve never seen anything like it before.”

Suffolk saw an 83 percent increase in the number of affidavit ballots as compared to 2008, the last time there were contested presidential primaries in both parties. Nassau did not have figures for 2008 available.

Bonnie Garone, acting counsel to Gugerty, said some voters may not have been aware that they could not vote in a closed primary or were “not cognizant” of their party registration because they had not voted in a recent primary.

Affidavits were also rejected because the voter was not registered or went to the wrong polling site, Garone said.

Critics said the October deadline for individuals to change their registration disenfranchises voters.

Jonathan Clarke, a Jericho-based lawyer with Election Justice USA, a voting rights organization, is representing voters with invalid affidavit ballots from New York City and Long Island residents who have filed a federal lawsuit. Clarke, a Democrat who is running in the Democratic primary to replace retiring Rep. Steve Israel (D-Huntington), said the early deadlines and heightened interest in insurgent candidacies created “a perfect storm” that prevented voters from casting ballots.

County elections officials said the law protects against “party raiding,” in which members of one party change their affiliation in high numbers to sabotage the other party’s results.

For example, the Suffolk Conservative Party in 2009 threw out 1,300 voters who were enrolled by the county Police Benevolent Association. The union wanted to deny renomination to Conservative Sheriff Vincent DeMarco after his deputies took over highway patrols from Suffolk County police.

In New York City, there were 121,056 affidavit ballots submitted, nearly five times the 26,242 cast during in 2008, according to data from the city Board of Elections. The board counted only 32,419 affidavit ballots, or just under 27 percent, records show.

advertisement | advertise on newsday

The city’s Board of Elections received criticism after 126,000 registered Democrats were erroneously purged from the rolls before the April 19 primary, and two board officials were suspended. Attorney General Eric Schneiderman has launched an investigation while City Comptroller Scott Stringer has said he will audit the board.

Voters whose affidavit ballots are rejected have 20 days to challenge the decision in court.

With David Schwartz