Last week, the New York State Court of Appeals, the highest court in the state, invalidated the House and state Senate districts that had been drawn by the Democrat-controlled legislature. The ruling was a shock to the state’s political class, which did not expect such a legal challenge—initiated by Republicans—to succeed in a court where six of seven judges are registered Democrats. The court decision threw the task of drawing new maps to a court-appointed special master, who will have until May 24 to produce new House maps. To comply with this timeline, the judges ordered federal and some state primaries to be shifted from June to August.

National Democrats recently filed a federal lawsuit hoping to block the appeals court’s decision, arguing that the state cannot move the date of the June federal primary. A decade ago, a federal decision forced all congressional primaries in New York to be held in late June to protect the rights of Americans casting ballots from overseas. On Wednesday, a federal judge shot the lawsuit down, allowing the special master’s work to proceed.

The stakes, of course, are incredibly high. Democrats have a tenuous grip on the House majority in Washington and were counting on New York to deliver maps that were friendly to the party. Legislative leaders did just that, engineering districts that could have added as many as three Democrats to New York’s House delegation.

The special master tasked with drawing the lines, an independent redistricting expert named Jonathan Cervas, is unlikely to take such partisan desires into account. If he defers to precedent, Democrats will, at best, be competing on neutral terrain. And when factoring in that Republicans traditionally dominated the redistricting process and seats were usually drawn to protect favored incumbents, deferring to past precedent will not give Democrats the lines they very badly wanted.

Republicans have had far more success gerrymandering their own districts across America and locking in gains for another decade. New York was intended to be a bulwark against such efforts. As of now, that won’t be a possibility.

The story of redistricting in New York is predictably labyrinthine. A decade ago, Andrew Cuomo, who was then governor, campaigned on a pledge to guarantee nonpartisan, independent redistricting. Democrats supported such a cause because Republicans controlled the state Senate, where they gerrymandered their districts and cut deals with Assembly Democrats to protect certain incumbents. Cuomo abandoned his pledge, and the speaker of the Democrat-run Assembly and the Republican majority leader agreed on new maps for the state legislature, authorizing gerrymanders in the upper chamber.

The trouble began when the leaders couldn’t reach consensus on House districts in a timely manner. A federal judge intervened, redrawing districts to follow, when possible, past precedent. National Democrats were quietly furious at Cuomo that he took so little interest in trying to help them.

With the 2012 maps settled—Republicans had their gerrymandered Senate, Democrats kept the districts they wanted in the Assembly, and a federal judge sketched the House seats—Cuomo promised that the next round of redistricting, in 2022, would be independent. In 2014, a constitutional amendment passed that barred gerrymandering and a new commission was set up to oversee the next decade’s redistricting. The commission wasn’t truly independent, because legislative leaders appointed members and the legislature, most experts believed, had the power to redraw the lines anyway if the bipartisan commission deadlocked.

Predictably, the commission did deadlock, producing two sets of maps, one friendly to Democrats and one friendly to Republicans. After the maps were released, the Democratic leaders of both chambers—in 2019, Democrats had flipped the Senate—very quickly moved to draw their own lines that were, undoubtedly, friendly to their caucuses. The maps were gerrymanders, but critics would have to prove that in court, where state judges typically didn’t intervene in redistricting matters.

A Republican legal challenge found a friendly Republican judge in upstate New York who ruled that the Democratic maps should be thrown out and a special master appointed to draw new lines. The Democrats appealed, losing partially at a higher court before appealing again to the version of New York’s Supreme Court, the court of appeals. It was there that the seven-member court surprised most legal experts by deciding the Democrats never had the constitutional right to draw their own districts. They had, according to the court, violated the new amendment passed in 2014.

What comes next is anyone’s guess. As of now, primaries for statewide races like governor are set for June. State Senate and House primaries were shifted, by court order, to late August. A lawsuit was recently brought against the Assembly maps that could void those as well, pushing primaries for those races to August. Downstate Democrats are incensed that a single hearing for the special master’s maps will be held in the upstate town of Bath, far from population centers and public transportation. It will be there simply because it was in Steuben County that the lawsuit against the Democratic maps was first brought.

For now, all voters can do is wait and see and hope clarity arrives at some point soon.