The Supreme Court (search) upheld strict limitations on family visits to inmates Monday, ruling that prisoners' civil rights do not outweigh security concerns in crowded prisons or wardens' worries that children could be hurt or abused while visiting relatives.

All nine justices agreed with the outcome of the case, a constitutional challenge to a 1995 Michigan policy meant to protect visitors and stop the smuggling of drugs and weapons in prison.

"The very object of imprisonment is confinement," Justice Anthony M. Kennedy (search) wrote. "Many of the liberties and privileges enjoyed by other citizens must be surrendered by the prisoner."

The ruling could affect visitation rights for prisoners in other states, if prison officials elsewhere copy the Michigan rules.

Under the Michigan policy, inmates could not have visits with minors other than their children or grandchildren, or with former prisoners unless they were immediate family. Inmates with two substance abuse violations in prison could only see clergy or lawyers.

The policy covered both noncontact visits -- in which the prisoner sees visitors through glass or some other barrier -- and contact visits. A lower court upheld the rules for contact visits, so the Supreme Court focused on noncontact visits.

The justices said prisoners may have some right to associate with family members, but that Michigan prison officials have good reasons for limiting family visits.

The court said the state had leeway to determine how best to keep order, including trying to keep drugs from being smuggled in. The state also had valid justification for keeping some children out of prison visitation rooms where they might be in danger, and where their presence causes disruption.

"Each of the challenged regulations bears a rational relationship to a legitimate penological interest," Kennedy wrote.

Chief Justice William H. Rehnquist and Justices John Paul Stevens, Sandra Day O'Connor, David Souter, Ruth Bader Ginsburg and Stephen Breyer fully agreed with Kennedy. Justices Antonin Scalia and Clarence Thomas agreed with the outcome but said the state's right to limit visitation was clear from the start.

Lawyers for a woman denied visits from her baby niece said the rules violated a constitutional right to intimate association by categorizing the people that prisoners could receive.

Twenty-one states and the federal government filed briefs in the case on Michigan's behalf.

Michigan changed some of its rules after the case began. In 2001, minor siblings were added to the list of immediate family members who could visit. In May 2002, minor nieces and nephews were allowed noncontact visits, and the substance abuse policy changed to limit prisoners to only noncontact visits after one violation.