New York’s highest court on Wednesday rejected new congressional maps that had widely been seen as favoring Democrats, largely agreeing with Republican voters who argued the district boundaries were unconstitutionally gerrymandered.

The decision may delay New York’s primary elections by as much as two months and is likely a hammer-blow to Democrats’ national redistricting hopes, which leaned heavily on their ability to gerrymander New York state to maximize the number of seats they could win in the U.S. House of Representatives.

The state’s Court of Appeals said the Democratic-led Legislature lacked the authority to redraw congressional and state Senate maps after an independent redistricting commission charged with crafting new maps failed to reach a consensus.

The judges also said lawmakers gerrymandered the congressional maps to Democrats’ favor, in violation of a 2014 constitutional amendment designed to rout out political gamesmanship in redistricting.

The Appeals Court handed authority to draw new district maps to an expert, known as a special court master, instead of the Legislature.