Corporations can spend freely to support or oppose candidates for president and Congress, the Supreme Court ruled on Thursday in a landmark decision that allows massive sums to be spent to influence future elections.

The 5-4 ruling split the high court along conservative and liberal lines. It was a defeat for the Obama administration and supporters of campaign finance laws who said that ending the limits would unleash a flood of corporate money into the political system.

The ruling will transform the political landscape and the rules on how money can be spent in this year's congressional election and the 2012 presidential contest.

Writing for the majority, Justice Anthony Kennedy said the limits violated constitutional free-speech rights.

We find no basis for the proposition that, in the context of political speech, the government may impose restrictions on certain disfavored speakers, he wrote.

In his sharply worded dissent, Justice John Paul Stevens wrote, The court's ruling threatens to undermine the integrity of elected institutions across the nation.

The justices overturned Supreme Court precedents from 2003 and 1990 that upheld federal and state limits on independent expenditures by corporate treasuries to support or oppose candidates.

This decision allows Wall Street to tap its vast corporate profits to drown out the voice of the public in our democracy, said Common Cause President Bob Edgar, a group that supports campaign finance limits.

LABOR UNIONS TOO

In the 2008 election cycle, nearly $6 billion was spent on all federal campaigns, including more than $1 billion from corporate political action committees, trade associations, executives and lobbyists.

The ruling will almost certainly allow labor unions to spend more freely in political campaigns also and it posed a threat to similar limits that had been imposed in about half of the country's 50 states.

The top court struck down the part of the federal law that restricted broadcast advertisements for or against political candidates right before elections that are paid for by corporations, labor unions and advocacy groups.

The 2002 campaign finance law at issue was named after Senator John McCain, the unsuccessful Republican presidential nominee in 2008, and Democratic Senator Russell Feingold.

The justices appeared at a special Thursday session to summarize the ruling and issued a total of five separate opinions exceeding 175 pages.

The decision was a victory for a conservative advocacy group's challenge to the campaign finance law as part of its efforts to broadcast and promote a 2008 movie critical of then-presidential candidate Hillary Clinton. She later became President Barack Obama's secretary of state.

The Obama administration defended the law and its restrictions on election-related spending by corporations, unions and interest groups. It said corporations for more than 100 years have been subject to special limits on spending in federal political campaign.

The court's conservative majority, with the addition of Chief Justice John Roberts and Justice Samuel Alito, both Bush appointees, previously voted to limit or strike down parts of the law designed to regulate the role of money in politics and prevent corruption.

The court's four liberals, including its newest member, Justice Sonia Sotomayor, who was appointed by Obama, dissented.

(Editing by Howard Goller)