WASHINGTON — The Supreme Court on Monday ruled by a 5-to-4 vote that officials may strip-search people arrested for any offense, however minor, before admitting them to jails even if the officials have no reason to suspect the presence of contraband.

Justice Anthony M. Kennedy, joined by the court’s conservative wing, wrote that courts are in no position to second-guess the judgments of correctional officials who must consider not only the possibility of smuggled weapons and drugs, but also public health and information about gang affiliations.

“Every detainee who will be admitted to the general population may be required to undergo a close visual inspection while undressed,” Justice Kennedy wrote, adding that about 13 million people are admitted each year to the nation’s jails.

The procedures endorsed by the majority are forbidden by statute in at least 10 states and are at odds with the policies of federal authorities. According to a supporting brief filed by the American Bar Association, international human rights treaties also ban the procedures.