WASHINGTON (Reuters) - In a major blow to election reformers, the U.S. Supreme Court on Thursday rejected efforts to rein in electoral map manipulation by politicians aimed at entrenching one party in power, a practice known as partisan gerrymandering that critics have said warps democracy.

The justices, in a landmark 5-4 ruling that could reverberate through U.S. politics for years to come, ruled for the first time that federal judges do not have the authority to curb partisan gerrymandering - a decision that could embolden state lawmakers to intensify use of the practice.

The court ruled along ideological lines in the decision written by Chief Justice John Roberts, with its conservative members in the majority and liberals in dissent. The court sided with Republican lawmakers in North Carolina and Democratic legislators in Maryland who drew electoral district boundaries that were challenged by voters as so politically biased that they violated rights guaranteed by the U.S. Constitution.

The geographical boundaries of legislative districts across the country are redrawn to reflect population changes measured by the census conducted by the federal government every decade. In most states, redistricting is done by the party in power.

Though both parties have engaged in partisan gerrymandering, President Donald Trump’s fellow Republicans have been the primary beneficiaries since the last round of redistricting following the 2010 census.

Election reformers had hoped the justices would intervene to stop political parties in power at the state level from using electoral maps to further cement their majorities and dilute the voting clout of people who support rival parties.

They warned that gerrymandering is becoming more extreme and can better engineer election outcomes with the use of precise voter data and powerful computer software, and will get worse if courts cannot curb it.

In the decision, Roberts said the court was not condoning excessive gerrymandering, which can yield election results that “seem unjust,” but added that it is an inherently political act reserved for legislatures, not courts, whose review would appear political.

The Constitution does not allow courts to forbid the practice, like it does racial discrimination in political map-drawing, Roberts said. “You can take race out of politics,” Roberts said from the bench, “but you can’t take politics out of politics.”

Gerrymandering, a practice dating back two centuries in the United States, is carried out by configuring electoral maps in a way that crams as many like-minded voters as possible into a small number of districts and spreading the rest in other districts too thinly to form a majority. These districts sometimes take on exotic shapes to include certain areas and exclude others.

‘DEEP SADNESS’

Liberal Justice Elena Kagan announced a lengthy dissent from the bench, noting that the gerrymandered districts have violated the constitutional rights of hundreds of thousands of Americans, whose votes count for less than they should merely because of their political views, undermining free and fair elections.

“The practices challenged in these cases imperil our system of government,” Kagan said. With her voice breaking, Kagan added that the four liberal justices dissented “with respect but deep sadness.”

House of Representatives Judiciary Committee Chairman Jerrold Nadler, a Democrat, said in a statement, “Partisan gerrymandering is fundamentally corrosive to democracy. Democratic government is required by definition to reflect the popular will.”

“Gerrymandering undermines democratic government by enabling minority factions to control state and local governments against the majority will, and to perpetuate that control by enacting gerrymanders,” Nadler added.

The ruling came on the final day of the court’s term. The justices also blocked, at least for now, the Trump administration’s contentious plan to add a citizenship question to the 2020 census.

The Supreme Court last year failed to issue definitive rulings on partisan gerrymandering in two cases - this same one from Maryland and another involving a Republican-drawn electoral map in Wisconsin.

Slideshow ( 4 images )

Thursday’s decision ends the gerrymandering challenges in North Carolina and Maryland. The North Carolina case focused on how Republican legislators reworked House districts in 2016 to ensure that 10 Republicans were elected, compared to just three Democrats, in a state whose voters are closely divided between the two parties.

Republicans were open about their intent. “I think electing Republicans is better than electing Democrats,” state House Representative David Lewis said at the time.

The lower court ruled last August that most of the contested districts violated provisions of the Constitutional including the guarantee of equal protection under the law.

North Carolina Democratic Party Chair Wayne Goodwin on Thursday said the “Supreme Court rewarded undemocratically elected politicians who continue to show they will rig our state and our country to hold onto power no matter the cost.”

Slideshow ( 4 images )

In the Maryland case, voters sued after the legislature redrew boundaries for the state’s Sixth District in a way that removed Republican-leaning areas and added Democratic-leaning areas, leading to the ouster of the incumbent Republican congressman.

Former Wisconsin Governor Scott Walker, now an official with the National Republican Redistricting Trust that aims to boost Republicans in the next round of redistricting, said, “Today’s opinion has finally pulled federal courts out of the business of picking winners and losers in redistricting cases.”

Walker added that a federal judiciary that is forced to consider “such inherently political questions would become just another partisan branch of government.”

Eric Holder, who served as U.S. attorney general under Democratic former President Barack Obama and now is chairman of the National Democratic Redistricting Committee, said, “This decision tears at the fabric of our democracy and puts the interests of the established few above the many. History will not be kind in its assessment.”

Some states assign the task of drawing electoral districts to independent commissions in the interest of fairness.

Roberts highlighted these efforts as well as state-level legal challenges that have curbed gerrymandering based on state constitutions, such as in Pennsylvania and Florida. But Roberts ruled out relief under the U.S. Constitution.

Democrats have said partisan gerrymandering by Republicans in such states as Wisconsin and Pennsylvania helped Trump’s party maintain control of the U.S. House and various state legislatures for years, although Democrats seized control of the House in last November’s elections and made inroads in state legislatures.

For a graphic on major Supreme Court rulings, click tmsnrt.rs/2V2T0Uf