WASHINGTON (CNN) -- The Supreme Court on Monday upheld a law aimed at preventing child pornography, ruling a provision dealing with "pandering" illicit material does not violate constitutional protections on free speech.

Justice Antonin Scalia wrote for the majority, calling Internet child porn a "threat."

The 7-2 ruling rejected suggestions the law is overly broad, and will stifle a range of expressive or artistic material that is not obscene.

The case involves Michael Williams, convicted in a Florida federal court for promoting child pornography on the Internet.

A 2003 federal law made it a crime not only to produce and possess child porn, but also to "pander" material, conveying the belief that material contains minors engaged in sexually explicit conduct. The pandering provision covers anyone who "advertises, promotes, presents, distributes, or solicits" this material.

Justice Antonin Scalia, writing for the majority, said Congress' latest attempt to deal with this "threat" was legally "successful."

The "Protect" Act was Congress' latest attempt to control graphic images on the Internet. Previous efforts were struck down by the high court on First Amendment issues.

As part of a 2004 sting operation, an undercover Secret Service agent (using the screen name "Lisa--n--Miami") communicated with Williams in an Internet chat room. Williams allegedly wrote, "Dad of toddler has 'good' pics of her an (sic) me for swap of your toddler pics, or live cam." He posted nonpornographic photos of a young girl and claimed he had "hc," or hard-core, kiddie pictures, prosecutors contend.

The man then allegedly posted photos of youngsters involved in "sexually explicit conduct," according to court records. Twenty-two other child porn images were found on his home computer.

A federal appeals court upheld a possession conviction against Williams, but threw out the separate soliciting charge, which carried a five-year mandatory minimum sentence. A three-judge panel concluded the provision was "substantially overbroad and vague," and that "non-commercial, non-inciteful promotion of illegal child pornography, even if repugnant, is protected free speech." In other words, the judges said merely talking about child porn is not necessarily criminal.

Scalia said judges had proper discretion to decide when anti-pornography laws should be properly applied, but he noted that such illicit material has increased in recent years.

"Child pornography harms and debases the most defenseless of our citizens," he said. "This court held unconstitutional Congress' previous attempt to meet this new threat, and Congress responded with a carefully crafted attempt to eliminate the First Amendment problems we [earlier] identified."

The Bush administration urged the high court to accept the case, saying the overall impact of the law was being held "hostage to a few hypothetical scenarios."

Solicitor General Paul Clement argued to the justices that not only is promoting real child porn against the law, but "speech that falsely proposes an unlawful transaction is likewise unprotected." Clement announced last week that he is stepping down from his post next month.

But during oral arguments, six justices offered specific examples they said might unfairly target someone who was engaged in lawful, artistic or editorial free speech. Among them were mainstream movies such as "Lolita," "Traffic," and "Titanic," all of which depicted scenarios in which underage girls were engaging in simulated sex.

Justices David Souter and Ruth Bader Ginsburg dissented.

Souter wrote that a double standard exists since those pandering images not involving minors engaging in simulated sex could now be prosecuted, but possession of those images would not be subject to prosecution.

"I believe that maintaining the First Amendment protection of expression we have previously held to cover fake child pornography requires a limit to the law's criminalization of pandering proposals," Souter said.

The justices five years ago struck down a 1996 federal law dealing with child porn, giving legal protection to youthful sexual images that were nether obscene nor involved sexual abuse. In its ruling, the high court said thinking dirty thoughts is not necessarily criminal, and the government cannot "suppress lawful speech as the means to suppress unlawful speech."

Most of the 2003 Protect Act's provision have survived judicial scrutiny.

A coalition of free speech and commercial interests were supporting Williams' constitutional claims, including the Free Speech Coalition and National Coalition Against Censorship.

On the other side, 27 states backed the United States, as well as a range of child advocacy groups.

Also on Monday, the justices:

• Reinstated the full conviction of a terrorist implicated in the failed "millennium" bomb plot in an 8-1 ruling. A jury had found Ahmed Ressam guilty of various conspiracy charges in the plan to detonate explosives at Los Angeles International Airport in the days before New Year's Day 2000. A federal appeals court had overturned some of the convictions, and the Justice Department successfully appealed to the Supreme Court. Opinion

• Refused to intervene in the pending deportation of a former Nazi prison camp guard, upholding a lower court ruling that authorized a 2004 removal order for John Demjanjuk, 87, to either his native Ukraine or to another country, possibly Poland or Germany. He was once accused by the U.S. and Israel of being the notoriously brutal S.S. guard known as "Ivan the Terrible."

All About U.S. Supreme Court • First Amendment Rights