A Steuben County Supreme Court judge on Friday declared that New York’s congressional and state Senate primary would be pushed to August 23rd, following a Court of Appeals decision on Wednesday that ruled the new district maps drawn by Democrats had been designed with partisan intent.

The order by Acting Supreme Court Judge Patrick McAllister will now give the court-appointed “special master” until May 20th to redraft the maps. The ruling gives time for candidates seeking public office to collect the required signatures to get on the ballot.

Read More: Candidates, election officials left in limbo after NY redistricting ruling

Friday’s order represented the latest development in what has become a political nightmare for Democrats in the state’s decennial redistricting process to determine boundaries of new legislative districts. Democrats control both chambers of the state Legislature. So when a bipartisan redistricting commission failed to produce consensus maps, lawmakers used their majority to try to push through congressional lines that could have resulted in the flipping of at least three House seats — and potentially help Democrats nationally who are facing a bruising battle in the midterm elections.

Their plan backfired. Republicans accused Democrats of gerrymandering and sued to have the maps invalidated in court. Democratic leaders insisted that the prior maps drawn by the GOP were in fact gerrymandered and they were merely seeking to redress those partisan lines.

Under the previous court decision, the races for governor, lieutenant governor, state Assembly and local primaries could still be held on June 28th, the original primary date. On Friday, McAllister said it will be up to the state Legislature to decide whether to consolidate all of the elections into one primary on August 23rd. The deadline for overseas and military ballots to be mailed will be July 8th.

Candidates who have already petitioned to get on the ballot based on the voided maps will now have to wait to see how the lines get redrawn.

McAllister has appointed Jonathan Cervas, a postdoctoral fellow at Carnegie Mellon University, to be the “special master” who will draw the new maps.