The Wisconsin Supreme Court said Friday that the state’s heavily gerrymandered legislative maps that favor Republicans were unconstitutional and ordered new maps before the 2024 election. The ruling has the potential to produce a seismic political shift in a crucial presidential swing state.

Justice Jill Karofsky, writing for the majority, said Wisconsin’s current maps violate a requirement in the state constitution “that Wisconsin’s state legislative districts must be composed of physically adjoining territory.”

“Given the language in the constitution, the question before us is straightforward,” she wrote. “When legislative districts are composed of separate, detached parts, do they consist of ‘contiguous territory’? We conclude that they do not.”

The decision was widely expected from a court that flipped to a 4-3 liberal majority this year after the most expensive judicial election in U.S. history. The winner of that election, Justice Janet Protasiewicz, a former Milwaukee County judge, was openly critical of the current legislative maps, calling them “rigged” and “unfair” during her campaign.

One day after Protasiewicz was sworn into the court in August, a coalition of voting rights groups and law firms filed a petition for the state Supreme Court to hear a redistricting case.

The petition, filed on behalf of 19 voters in Wisconsin, sought to have new maps drawn by March.