Last year, Democratic justices on the North Carolina Supreme Court ruled that maps of the state’s legislative and congressional districts drawn to give Republicans lopsided majorities were illegal gerrymanders. On Friday, the same court led by a newly elected Republican majority looked at the same facts, reversed itself and said it had no authority to act.

The practical effect is to enable the Republican-controlled General Assembly to scrap the court-ordered State House, Senate and congressional district boundaries that were used in elections last November, and draw new maps skewed in Republicans’ favor for elections in 2024. The 5-to-2 ruling fell along party lines, reflecting the takeover of the court by Republican justices in partisan elections last November.

The decision has major implications not just for the state legislature, where the G.O.P. is barely clinging to the supermajority status that makes its decisions veto-proof, but for the U.S. House, where a new North Carolina map could add at least three Republican seats in 2024 to what is now a razor-thin Republican majority. Overturning such a recent ruling by the court was a highly unusual move, particularly on a pivotal constitutional issue in which none of the facts had changed.

The North Carolina case mirrors a national trend in which states that elect their judges — Ohio, Kentucky, Kansas, Wisconsin, Pennsylvania and others — have seen races for their high court seats turned into multimillion-dollar political battles, and their justices’ rulings viewed through a deeply partisan lens.

Such political jockeying once was limited mostly to confirmation fights over seats on the U.S. Supreme Court. But as the nation’s partisan divide has deepened, and the federal courts have offloaded questions about issues like abortion and affirmative action to the states, choosing who will decide state legal battles has increasingly become an openly political fight.

The new Republican majority of justices said the North Carolina Supreme Court had no authority to strike down partisan maps that the General Assembly had drawn.

“Our constitution expressly assigns the redistricting authority to the General Assembly subject to explicit limitations in the text,” Chief Justice Paul Newby wrote for the majority. “Were this court to create such a limitation, there is no judicially discoverable or manageable standard for adjudicating such claims.”

Justice Newby said that Democrats who led the previous court had claimed to have developed a standard for deciding when a political map was overly partisan, but that it was “riddled with policy choices” and overstepped the State Constitution’s grant of redistricting powers to the legislature.

Legal scholars said the ruling also seemed likely to derail a potentially momentous case now before the U.S. Supreme Court involving the same maps. In that case, Moore v. Harper, leaders of the Republican-run legislature have argued that the U.S. Constitution gives state lawmakers the sole authority to set rules for state elections and political maps, and that state courts have no role in overseeing them.

Now that the North Carolina Supreme Court has sided with the legislature and thrown out its predecessor’s ruling, there appears to be no dispute for the federal justices to decide, the scholars said.

The ruling drew a furious dissent from one of the elected Democratic justices, Anita S. Earls, who said that it was pervaded by “lawlessness.” She accused the majority of making specious legal arguments, and at times using misleading statistics, to make a false case that partisan gerrymandering was beyond its jurisdiction.

“The majority ignores the uncontested truths about the intentions behind partisan gerrymandering and erects an unconvincing facade that only parrots democratic values in an attempt to defend its decision, ” she wrote. “These efforts to downplay the practice do not erase its consequences and the public will not be gaslighted.”

Some legal experts said the ruling underscored a trend in state courts that elect their justices, in which decisions in politically charged cases increasingly align with the ideological views of whichever party holds the majority on the court, sometimes regardless of legal precedent.

“If you think the earlier State Supreme Court was wrong, we have mechanisms to change that, like a constitutional amendment,” Joshua A. Douglas, a scholar on state constitutions at the University of Kentucky College of Law, said in an interview. “But changing judges shouldn’t cause such a sea change in the rule of law, because if that’s the case, precedent has no value any longer, and judges really are politicians.”

The state court also handed down two more rulings in politically charged cases, overturning decisions that favored voting-rights advocates and their Democratic supporters.

In the first, the justices reconsidered and reversed a ruling by the previous court, again along party lines, that a voter ID law passed by the Republican majority in the legislature violated the equal protection clause in the State Constitution.

In the second, the justices said a lower court “misapplied the law and overlooked facts crucial to its ruling” when it struck down a state law denying voting rights to people who had completed prison sentences on felony charges but were not yet released from parole, probation or other court restrictions.

The lower court had said that the state law was rooted in an earlier law written to deny voting rights to African Americans, a conclusion that the Supreme Court justices said was mistaken.

The new ruling undid a decision that had restored voting rights to more than 55,000 North Carolinians who had completed prison sentences. Those rights are now revoked, lawyers said, although the status of former felons who had already registered or voted under the previous ruling appeared unclear.

The ruling on Friday in the gerrymander case, now known as Harper v. Hall, came after partisan elections for two Supreme Court seats in November shifted the seven-member court’s political balance to 5-to-2 Republican, from 4-to-3 Democratic.

The Democratic-controlled court ruled along party lines in February 2022 that both the state legislative maps and the congressional district maps approved by the Republican legislature violated the State Constitution’s guarantees of free speech, free elections, free assembly and equal protection.

A lower court later redrew the congressional map to be used in the November elections, but a dispute over the State Senate map, which G.O.P. leaders had redrawn, bubbled back to the State Supreme Court last winter. In one of its last acts, the Democratic majority on the court threw out the G.O.P.’s State Senate map, ordering that it be redrawn again. The court then reaffirmed its earlier order in a lengthy opinion.

Ordinarily, that might have ended the matter. But after the new Republican majority was elected to the court, G.O.P. legislative leaders demanded that the justices rehear not just the argument over the redrawn Senate map, but the entire case.

The ruling on Friday came after a brief re-argument of the gerrymander case in mid-March.

North Carolina voters are almost evenly split between the two major parties; Donald J. Trump carried the state in 2020 with 49.9 percent of the vote. But the original map of congressional districts approved by the G.O.P. legislature in 2021, and later ruled to be a partisan gerrymander, would probably have given Republicans at least 10 of the state’s 14 seats in the U.S. House of Representatives.

Using a congressional map drawn last year by a court-appointed special master, the November election delivered seven congressional seats to each party. With the decision on Friday, the G.O.P. legislature is likely to approve a new map along the lines of its first one, giving state Republicans — and the slender Republican majority in the U.S. House — the opportunity to capture at least three more seats.