Police are allowed to take DNA samples from people they arrest on charges of serious crimes, even if there are no plans to prosecute them for the offenses, the U.S. Supreme Court ruled in a 5-4 decision handed down Monday.

Justice Anthony Kennedy wrote the majority opinion for the court. Also voting with Kennedy were Chief Justice John Roberts and Justices Clarence Thomas, Stephen Breyer and Samuel Alito. Justice Antonin Scalia, who wrote the dissenting opinion, joined Justices Ruth Bader Ginsberg, Sonia Sotomayor and Elena Kagan in the minority.

The case, Maryland vs. King, stemmed from a ruling by the Maryland Court of Appeals, which said that the DNA cheek swab from Alonzo Jay King obtained by the authorities in Wicomico County, Md., was unlawful. King’s DNA was taken following his 2009 arrest on assault charges, and the material linked him to an unsolved 2003 rape. King was later convicted of the rape, but Maryland’s highest court threw it out, arguing that he was subject to unlawful search and seizure.

But Monday’s ruling by the high court reversed Maryland court’s decision, with Kennedy arguing that DNA samples are the 21st-century equivalent of fingerprinting and does not constitute a violation of the Fourth Amendment.

“When officers make an arrest supported by probable cause to hold for a serious offense and they bring the suspect to the station to be detained in custody, taking and analyzing a cheek swab of the arrestee’s DNA is, like fingerprinting and photographing, a legitimate police booking procedure that is reasonable under the Fourth Amendment,” Kennedy wrote.

Scalia and the dissenting judges didn’t see it that way. While the ruling may solve more cases, the justice wrote, a DNA swab taken without suspicion that the arrested person committed a crime is unconstitutional. The justice even went so far as to say he believed the ruling may open up the possibility of DNA swabs being taken for any crime.

“[Monday’s] judgment will, to be sure, have the beneficial effect of solving more crimes; then again, so would the taking of DNA samples from anyone who flies on an airplane (surely the Transportation Security Administration needs to know the ‘identity’ of the flying public), applies for a driver’s license or attends a public school. Perhaps the construction of such a genetic panopticon is wise. But I doubt that the proud men who wrote the charter of our liberties would have been so eager to open their mouths for royal inspection,” Scalia wrote. “I, therefore, dissent and hope that today’s incursion upon the Fourth Amendment, like an earlier one, will some day be repudiated.”

The decision was seen as a boon to law enforcement agencies who conduct DNA swabs, with Maryland Attorney General Douglas Gansler calling the ruling a “resounding victory.” Maryland and 28 other states have DNA swab laws.