The Supreme Court on Wednesday upheld a law that retroactively extended copyrights protecting the profits of songs, books and cartoon characters. It was a huge victory for Disney and other companies.

The 7-2 ruling, while not unexpected, was a blow to Internet publishers and others who wanted to make old books available online and use the likenesses of a Mickey Mouse cartoon and other old creations without paying high royalties.

Hundreds of thousands of books, movies and songs were close to being released into the public domain when Congress extended the copyright by 20 years in 1998.

Justices said the copyright extension, named for the late Rep. Sonny Bono, R-Calif., was not unconstitutional.

The Constitution "gives Congress wide leeway to prescribe `limited times' for copyright protection and allows Congress to secure the same level and duration of protection for all copyright holders, present and future," Justice Ruth Bader Ginsburg said from the bench.

A contrary ruling would have cost entertainment giants like The Walt Disney Co. and AOL Time Warner Inc. hundreds of millions of dollars. AOL Time Warner had said that would threaten copyrights for such movies as Casablanca, The Wizard of Oz and Gone With the Wind.

Also at risk of expiration was protection for the version of Mickey Mouse portrayed in Disney's earliest films, such as 1928's Steamboat Willie.

Congress passed the copyright law after heavy lobbying from companies with lucrative copyrights.

During the argument in the case last October, some justices seemed bothered by the retroactive extension but they also were concerned about their standing to overturn it.

The Constitution allows Congress to give authors and inventors the exclusive right to their works for a "limited" time.

Congress has repeatedly lengthened the terms of copyrights over the years. Copyrights lasted only 14 years in 1790. With the challenged 1998 extension, the period is now 70 years after the death of the creator. Works owned by corporations are now protected for 95 years.

Justices John Paul Stevens and Stephen Breyer disagreed with their colleagues.

Stevens wrote that the court was "failing to protect the public interest in free access to the products of inventive and artistic genius."