The high court reversed a lower court decision that said Congress overstepped its authority in allowing indefinite detentions of considered "sexually dangerous."
"The statute is a 'necessary and proper' means of exercising the federal authority that permits Congress to create federal criminal laws, to punish their violation, to imprison violators, to provide appropriately for those imprisoned and to maintain the security of those who are not imprisoned by who may be affected by the federal imprisonment of others," said Justice Stephen Breyer, writing the majority opinion.
President George W. Bush in 2006 signed the Adam Walsh Child Protection and Safety Act, which authorized the civil commitment of sexually dangerous federal inmates.
The act, named after the son of "America's Most Wanted" television host John Walsh, was challenged by four men who served prison terms ranging from three to eight years for possession of child pornography or sexual abuse of a minor. Their confinement was supposed to end more than two years ago, but prison officials said there would be a risk of sexually violent conduct or child molestation if they were released.
A fifth man who also was part of the legal challenge was charged with child sex abuse, but declared incompetent to stand trial.
The 4th U.S. Circuit Court of Appeals in Richmond, Va., ruled last year that Congress overstepped its authority when it enacted a law allowing the government to hold indefinitely people who are considered "sexually dangerous."
But "we conclude that the Constitution grants Congress legislative power sufficient to enact" this law, Breyer said.
Justice Clarence Thomas dissented, saying Congress can only pass laws that deal with the federal powers listed in the Constitution.
Nothing in the Constitution "expressly delegates to Congress the power to enact a civil commitment regime for sexually dangerous persons, nor does any other provision in the Constitution vest Congress or the other branches of the federal government with such a power," Thomas said.
Thomas was joined in part on his dissent by Justice Antonin Scalia.
Chief Justice John Roberts last year granted an administration request to block the release of up to 77 inmates at a federal prison in North Carolina. These were people whose prison terms for sex offenses were ending. The justice's order was designed to allow time for the high court to consider the administration's appeal.
The Adam Walsh Child Protection and Safety Act also establishes a national sex offender registry, increases punishments for some federal crimes against children and strengthens child pornography protections. Those provisions are not being challenged.
State laws allowing civil commitments of sex offenders also are unaffected.
The case is U.S. v. Comstock, 08-1224.
The court also ruled Monday on the following:
• By a 5-4 vote, the court said teenagersif they have not killed anyone.
The court says the U.S. Constitution requires that young people serving life sentences must at least be considered for release.
• The high court ruled an American mother illegally moved her son from Chile to the United States during a custody dispute with the boy's British father.
The high court on Monday said an international child custody treaty demands that the child goes back to the South American country.
The parents separated in Chile, and the courts there had granted the father visitation rights. But the mother fled with the boy to Texas and filed for divorce. She asked the court there to change the father's visitation rights. The father asked that the boy be returned to Chile.
The justices say the mother can argue in the lower courts that her safety may be at risk in Chile. That is an exception that can overrule the requirement that the child be returned to Chile.
• The Supreme Court declined to take up a challenge from cable television operators to the 18-year-old requirement that they carry local broadcast stations on their systems.
The justices rejected an appeal Monday from Cablevision Systems Corp. The court upheld a federal "must carry" law, enacted in 1992 when cable TV systems faced much less competition than they do today.
Cablevision, the nation's fifth-largest cable TV operator, sued the Federal Communications Commission over its ruling that forced Cablevision to carry the signal of a distant home-shopping station on its Long Island cable systems. The federal appeals court in New York upheld the FCC's determination.