By a 5-4 vote, the court ruled against a New Jersey man who complained that strip searches in two county jails violated his civil rights.

Justice Anthony Kennedy said in his majority opinion for the court's conservative justices that when people are going to be put into the general jail population, "courts must defer to the judgment of correctional officials unless the record contains substantial evidence showing their policies are an unnecessary or unjustified response to problems of jail security."

In a dissenting opinion joined by the court's liberals, Justice Stephen Breyer said strip searches improperly "subject those arrested for minor offenses to serious invasions of their personal privacy." Breyer said jailers ought to have a reasonable suspicion someone may be hiding something before conducting a strip search.

Albert Florence was forced to undress and submit to strip searches following his arrest on a warrant for an unpaid fine, though the fine actually had been paid. Even if the warrant had been valid, failure to pay a fine is not a crime in New Jersey.

But Kennedy focused on the fact that Florence was held with other inmates in the general population. In concurring opinions, Chief Justice John Roberts and Justice Samuel Alito said the decision left open the possibility of an exception to the rule and might not apply to someone held apart from other inmates.

The first strip search of Florence took place in the Burlington County Jail in southern New Jersey. Six days later, Florence had not received a hearing and remained in custody. Transferred to another county jail in Newark, he was strip-searched again.

The next day, a judge dismissed all charges. Florence's lawsuit soon followed.

He may still pursue other claims, including that he never should have been arrested.

Florence's problems arose in March 2005, as he was heading to dinner at his mother-in-law's house with his pregnant wife and 4-year-old child. His wife, April, was driving when a state trooper stopped the family SUV on a New Jersey highway.

Florence identified himself as the vehicle's owner and the trooper, checking records, found an outstanding warrant for an unpaid fine. Florence, who is African-American, had been stopped several times before, and he carried a letter to the effect that the fine, for fleeing a traffic stop several years earlier, had been paid.

His protest was in vain, however, and the trooper handcuffed him and hauled him off to jail. At the time, the State Police were operating under a court order, spawned by allegations of past racial discrimination, that provided federal monitors to assess state police stops of minority drivers. But the propriety of the stop is not at issue, and Florence is not alleging racial discrimination.

Kennedy gave three reasons to justify routine searches  detecting lice and contagious infections, looking for tattoos and other evidence of gang membership and preventing smuggling of drugs and weapons.

Kennedy also said people arrested for minor offenses can turn out to be "the most devious and dangerous criminals." Oklahoma City bomber Timothy McVeigh initially was stopped by a state trooper who noticed McVeigh was driving without a license plate, Kennedy said.

In his dissent, Breyer said inmates in the two New Jersey jails already have to submit to pat-down searches, pass through metal detectors, shower with delousing agents and have their clothing searched.

Many jails, several states and associations of corrections officials say strip searches should only be done when there is reasonable suspicion, which could include arrest on drug charges or for violent crimes, Breyer said.

In 1979, the Supreme Court upheld a blanket policy of conducting body cavity searches of prisoners who had had contact with visitors on the basis that the interaction with outsiders created the possibility that some prisoners got hold of something they shouldn't have.

For the next 30 or so years, appeals courts applying the high court ruling held uniformly that strip searches without suspicion violated the Constitution.

But since 2008  and in the first appellate rulings on the issue since the Sept. 11, 2001, terrorist attacks  appeals courts in Atlanta, Philadelphia and San Francisco decided that authorities' need to maintain security justified a wide-ranging search policy, no matter the reason for someone's detention.

The high court upheld the ruling from the Philadelphia court, the 3rd U.S. Circuit Court of Appeals.

The case is Florence v. Board of Chosen Freeholders of County of Burlington, 10-945.