A mid-level state appeals court ruled Democrats gerrymandered New York’s new congressional districts to their favor, setting up a pending showdown in the state’s top court that could sway the balance of power in the U.S. House of Representatives.

The state Appellate Division in Rochester issued a split decision Thursday upholding a lower court’s ruling that threw out the Democrat-drawn congressional districts, finding they violated the state constitution’s ban on drawing district lines to benefit a particular party. But the appeals court reinstated New York’s newly drawn state Senate and Assembly district lines, which the trial court judge had also tossed on procedural grounds.

In a 3-2 decision, the Appellate Division ruled the Legislature’s Democratic majorities violated a clause in the state constitution – added in 2014 – that prohibits districts that are “drawn to discourage competition or for the purpose of favoring or disfavoring incumbents or other particular candidates or political parties.”

The ruling gives the Democrat-led state Legislature until April 30 to draw a new set of congressional lines for the June 28 primary, which could be moved back to account for the delay.

But the decision is not final: Democrats have vowed to immediately appeal, and the Court of Appeals, the state’s top court, will have final say. The seven-member court has already signaled it will hear the case on an expedited schedule, perhaps as soon as next week.

“We always knew this case would end at the Court of Appeals and look forward to being heard on our appeal to uphold the congressional map,” said Mike Murphy, a spokesperson for state Senate Democrats.

We always knew this case would end at the Court of Appeals and look forward to being heard.

Mike Murphy, spokesman for state Senate Democrats.

The legal battle between Republicans and Democrats is based on the state’s decennial redistricting process, in which legislative districts are redrawn to account for population shifts in the latest U.S. Census.

The new maps – 26 congressional, 63 state Senate and 150 state Assembly districts – were drawn earlier this year by the Democrats who control the state Legislature. They came after a new, bipartisan panel — the Independent Redistricting Commission — failed to reach consensus on a single set of maps. Republicans sued, arguing that the congressional and state Senate maps unfairly favored Democrats by being drawn in a way that gave the party an advantage.

The fate of New York’s maps could have a significant impact in Washington, D.C. where Democrats and Speaker Nancy Pelosi are clinging to a slim majority in the House. If Democrats are able to pick up a few seats in New York — especially in key swing districts — it could help them maintain their grip on congressional power.

Under the Democrat-drawn maps, 22 of the New York’s congressional districts would favor Democratic candidates with the remaining four favoring Republicans, according to The Cook Political Report, which meticulously analyzes House races. As of now, New York’s congressional delegation has 19 Democrats and eight Republicans. (The state is losing a seat in this year’s elections based on the 2020 Census.)

Republicans relied on testimony from Sean Trende, senior elections analyst for Real Clear Politics, who ran computer simulations that created thousands of potential outcomes, concluding that Democrats drew the maps to their favor.

The judges ruled Trende’s testimony, combined with the dramatic Democratic shift in the maps as well as a lack of Republican support, were enough to prove Democrats gerrymandered the congressional maps to their favor.

“We are pleased that the Appellate Division confirmed what all New Yorkers know: The congressional map that the Democrats in the Legislature adopted is an egregious, unconstitutional gerrymander,” said former U.S. Rep. John Faso of Hudson Valley, who has been serving as the Republican Party’s de facto spokesperson for the redistricting lawsuit.

The appeals court sided with Acting Supreme Court Justice Patrick McAllister of Steuben County, who had tossed the congressional maps earlier this month. But the appeals court differed with McAllister on the state Senate and Assembly maps, which were also drawn by Democrats.

McAllister, a Republican, ruled the state-level maps were invalid because the Legislature didn’t have the authority to approve them after the Independent Redistricting Commission process collapsed. But the Appellate Division ruled the Legislature did have the power, in large part because the Constitution is silent as to what would happen when the independent commission failed to send over a second set of maps – which is what ultimately happened.

Because of that, the appeals court reinstated the state Senate and Assembly districts, which were never ruled to have been gerrymandered. It wasn’t immediately clear late Thursday whether Republicans intend to appeal that part of the ruling.

Associate Justices John Centra, Stephen Lindley and John Curran all backed the ruling, though Curran also wrote that he believed the state Senate maps should have been thrown out as well.

Presiding Justice Gerald Whalen and Associate Justice Joanne Winslow dissented.

The final appeal will now be heard at the Court of Appeals in Albany, where all seven members were appointed by Democratic Govs. Andrew Cuomo and Kathy Hochul.

Time is of the essence: For the June 28 primary, ballots must be printed by early May in order to comply with federal law requiring absentee ballots to arrive on time for military personnel overseas.

McAllister’s original ruling had raised the possibility of moving the primary back to as late as August. But so far, the Legislature hasn’t acted to push the date back, pending resolution of the ongoing court case.