The Democratic primary for Queens district attorney is headed to court.

The campaigns of Tiffany Cabán and Melinda Katz are fighting over the validity of about 114 affidavit ballots lacking information about party affiliation.

Both parties are set to appear before Queens County Supreme Court on Tuesday morning.

Katz's lead over Cabán shrunk to 16 votes, from 20, after the counting Friday of six affidavit ballots that had initially been classified as invalid.

The New York City Board of Elections conducted an initial count of absentee and affidavit ballots Wednesday. Before that, Cabán was in the lead by about 1,100 votes.

Cabán's lawyer filed a lawsuit Tuesday as a precautionary measure.

"We do that as a prophylactic," Jerry Goldfeder said. "Just to make sure that in case there are disputes, there's a judge ready to resolve them."

Cabán's campaign is arguing that affidavit ballots deemed invalid should be counted, and is hoping those will give the public defender the lead back.

Because the margin of victory is under 0.5 percent of the total vote, the Board of Elections will have to do a full manual recount before declaring a winner.

That recount could start as early as Tuesday. At this point, the Board of Elections is expecting to certify the final result July 16, although it's not clear how long the legal dispute will last.

The race hasn't officially been called, but Cabán declared herself the winner after she held a lead of about 1,100 ballots (about 1 percent) among the roughly 81,000 votes cast in the primary June 25. It was touted as a major upset for the Queens Democratic Party, which supported Katz's candidacy. But Katz, the Queens borough president, did not concede, demanding every ballot be counted. She then declared herself the winner after the initial count of absentee and affidavit ballots showed she had the slim lead.

The candidates for Queens DA had been debating how to implement criminal justice reforms becoming popular around the United States, such as ending cash bail and reducing jail populations — and they debated how far the policies should go.

The next Queens district attorney will enter an office that had been occupied for nearly three decades by Richard Brown, who passed away earlier this year.

Katz was arguably viewed as the frontrunner in the race because she had the support of most of the Queens Democratic Party and many labor union endorsements, but she faced a spirited challenge from Cabán, who seemed to gain momentum late in the primary season. Cabán earned the endorsements of several prominent progressives, such as New York Rep. Alexandria Ocasio-Cortez, Philadelphia DA Larry Krasner, Senators Bernie Sanders and Elizabeth Warren, and the New York Times endorsed her. Cabán also got a late boost in donations — more than $233,000 in a three-week span before the primary, compared to Katz's $172,000.

The initial election results sent shockwaves through the city's political establishment and garnered Cabán national headlines.

Whoever wins will advance to the November general election, which the Democrat is expected to win.

------

Looking for an easy way to learn about the issues affecting New York City?

Listen to our "Off Topic/On Politics" podcast: Apple Podcasts | Google Play | Spotify | iHeartRadio | Stitcher | RSS