The Supreme Court ruled Monday that those arrested for even minor violations may be strip-searched before being admitted to jail, saying safety concerns outweigh personal privacy rights.

The court’s conservatives ruled against a New Jersey man who was strip-searched after being mistakenly arrested on an outstanding warrant.

Justice Anthony M. Kennedy wrote the majority opinion in the 5 to 4 ruling, saying that correctional officials have good reason to “perform thorough searches at intake for disease, gang affiliation, and contraband.”

“There is a substantial interest in preventing any new inmate, either of his own will or as a result of coercion, from putting all who live or work at these institutions at even greater risk when he is admitted to the general population,” Kennedy wrote.

More than 13 million people are admitted to jails each year, Kennedy wrote.

The Supreme Court’s decision continued a trend that began after the Sept. 11, 2001, attacks of giving jailers more leeway in searching those picked up even for the most minor offenses, such as expired licenses or noisy mufflers.

At the same time, at least 10 states have forbidden strip searches without reasonable suspicion. And the Federal Bureau of Prisons does not subject those arrested for misdemeanor or civil contempt offenses to visual body-cavity searches without their consent or reasonable suspicion that they may be hiding contraband. They are kept from the general prison population.

Kennedy noted there are many definitions to the term “strip search” and said the decision relates to close visual inspection of a person’s body without touching.

Chief Justice John G. Roberts Jr. and Justice Samuel A. Alito Jr. agreed with the outcome of the case but wrote separately to emphasize that the decision concerned only those admitted to the general population of a correctional facility. An exception to the rule might apply to those detained on minor charges and kept apart from the rest of the jail population, they said.

Steven R. Shapiro, legal director of the American Civil Liberties Union, said the decision “jeopardizes the privacy rights of millions of people who are arrested each year and brought to jail, often for minor offenses.”

But he noted that states were still allowed to forbid such searches and said the justices were “careful to recognize that strip searches may still be unconstitutional under certain circumstances.”

Justice Stephen G. Breyer wrote a dissenting opinion, joined by the rest of the court’s liberals. He said corrections officials must have reason to believe that the person arrested poses a danger before subjecting them to a strip search that is “inherently harmful, humiliating, and degrading.”

“And the harm to privacy interests would seem particularly acute where the person searched may well have no expectation of being subject to such a search, say, because she had simply received a traffic ticket for failing to buckle a seatbelt, because he had not previously paid a civil fine, or because she had been arrested for a minor trespass,” Breyer wrote.

The case was brought by Albert Florence, a New Jersey man who said he was subjected to two invasive inspections in 2005 after being mistakenly arrested for not paying a fine.

A state trooper pulled over Florence’s BMW in 2005 as he and his family were on the way to his mother-in-law’s to celebrate the purchase of their new home. He was handcuffed and arrested in front of his distraught, pregnant wife and young son.

He spent seven days in jail because of a warrant that said, mistakenly, that he was wanted for not paying a court fine. In fact, he had proof that the fine had been paid years earlier; he said he carried it in his glove box because he believed that police were suspicious of black men who drove nice cars.

Florence was jailed in Burlington County and then Essex County before a magistrate ordered him released. At Burlington, he said, he was forced to disrobe in front of an officer and told to lift his genitals. At Essex, he was strip-searched again and, he said, was made to squat and cough in front of others, a maneuver meant to expel anything hidden in a body cavity.

In 1979, the Supreme Court said that prisons could conduct body-cavity searches of inmates after visits with outsiders, on the theory that those from the outside world might attempt to bring contraband to the prisoner.

But for decades afterward, courts held that there were constitutional issues involved when someone was being arrested and detained. In 2008, appeals courts began giving correctional officials approval for more invasive searches, even for minor offenses.

Kennedy’s opinion said corrections officials “must have substantial discretion to devise reasonable solutions to the problems they face.”

He said jailers must be effective in ensuring that weapons are not brought into jails. They have an interest in examining detainees for wounds, signs of disease or gang tattoos. They have a need to stop the smuggling of drugs. Corrections officials do not have to have a reason to believe an individual detainee might pose a risk if he or she is being admitted into the general population, Kennedy said.

“The record provides evidence that the seriousness of an offense is a poor predictor of who has contraband and that it would be difficult in practice to determine whether individual detainees fall within the proposed exemption,” Kennedy wrote.

He noted that Timothy Mc­Veigh was stopped by a state trooper after the Oklahoma City federal building bombing for driving without a license plate. And one of the Sept. 11 hijackers was “stopped and ticketed for speeding just two days before hijacking Flight 93.”

Kennedy’s ruling indicated that those subjected to a search but not placed in the general population might have a case. Justice Clarence Thomas did not join that part of the decision.

Breyer said the decision would legitimize searches conducted to harass or humiliate people for their political views, such as a nun who was strip-searched after being arrested in an antiwar protest. He mentioned instances in the briefs filed with the court in which individuals were searched for “such infractions as driving with a noisy muffler, driving with an inoperable headlight, failing to use a turn signal, or riding a bicycle without an audible bell.”

Breyer said that he agreed that jailers have a difficult job but that neither Kennedy’s opinion nor the briefs submitted to the court contained any examples in which “contraband was smuggled into the general jail population during intake that could not have been discovered if the jail was employing a reasonable suspicion standard.”

His dissent was joined by Justices Ruth Bader Ginsburg, Sonia Sotomayor and Elena Kagan.

The case is Florence v. Board of Chosen Freeholders of the County of Burlington .