The Supreme Court on Thursday struck down limits on what some judicial candidates may tell voters, a landmark free speech ruling that could heat up court campaigns around the country.

Nearly 40 states elect some judges, and also restrict what they say or do while campaigning to promote an image of fairness and independence for courts.

The Supreme Court, in throwing out strict limits in Minnesota on a 5-4 vote, said the rules, while well-intended, impose an unconstitutional gag order.

Minnesota is one of nine states that had banned would-be judges from announcing views on "disputed legal or political issues." Most other states keep candidates from divulging their positions on issues that might come before their court. 

Justice Antonin Scalia, writing for the majority, said "there is an obvious tension" between the state's popular elections for judges and the limit "which places most subjects of interest to the voters off limits." 

The case presented a tricky free-speech question at a time when races for state courts have become expensive and often partisan battles. This year 33 states are holding high court elections, potentially the most costly ever.

The ruling should affect the eight states that have similar provisions: Arizona, Colorado, Iowa, Maryland, Mississippi, Missouri, New Mexico and Pennsylvania. Other states may also have to change their rules. 

The Minnesota restrictions had been challenged by Republicans and a three-time candidate for the state high court who contends that state rules leave voters with little useful information about candidates. 

Lawyers in the case are also involved in one of the legal challenges to the nation's new campaign finance law. That fight is also headed to the Supreme Court. 

This case pitted the First Amendment guarantee of free speech against the sanctity of the judiciary. It put justices in the uneasy position of deciding if states have a compelling interest in controlling elections for court. 

Justice Sandra Day O'Connor is the only court member who has been elected to a judgeship, as a superior court judge. The justices are appointed to lifetime terms. 

O'Connor joined Scalia in overturning the rules, along with the other conservative members of the court: Chief Justice William H. Rehnquist and Justice Anthony M. Kennedy.

In a dissent, Justice John Paul Stevens said the ruling will allow more politics in judicial elections. 

"The judicial reputation for impartiality and open-mindedness is comprised by electioneering that emphasizes the candidate's personal predilections rather than his qualifications for judicial office," he wrote. 

The Minnesota judicial rules were opposed by an assembly of groups, including the U.S. Chamber of Commerce, the conservative American Center for Law and Justice and the liberal American Civil Liberties Union. 

They were backed by a heavyweight group of lawyers and judges, who argue that elections for judges are different than traditional political races. 

Steven Lubet, a law professor at Northwestern University, said the court was saying "there is no difference between running for judge and running for alderman."