Image caption The Supreme Court has taken up several cases with the potential for far-reaching precedents this term

The US Supreme Court has ruled police may routinely take DNA cheek swabs from suspects who have been arrested but not yet convicted of a crime.

Ruling five to four, the court said the DNA could help solve old cases.

Writing for the majority, Justice Anthony Kennedy likened cheek swabs to fingerprinting or photographing.

But dissenting justices said it was an unreasonable and unconstitutional search, with one warning the practice could lead to a national DNA database.

In the majority opinion, Justice Kennedy described a cheek swab of DNA as a "legitimate police booking procedure" that fell within the confines of the US Constitution's Fourth Amendment, which bars unreasonable search and seizure.

But four dissenting justices said that the court was allowing a major change in police powers.

The long-term consequence of that decision will almost certainly be a system of genetic surveillance encompassing millions of innocents Julian Sanchez, Cato Institute Viewpoints: DNA samples

"Make no mistake about it: because of today's decision, your DNA can be taken and entered into a national database if you are ever arrested, rightly or wrongly, and for whatever reason," Justice Antonin Scalia wrote in a sharp dissent which he read aloud in the courtroom.

Justice Scalia was joined in his dissent by Justices Ruth Bader Ginsburg, Sonia Sotomayor and Elena Kagan.

The practice was in use by federal authorities and in at least 28 states before it was suspended pending the outcome of the case.

The case came to the Supreme Court after a Maryland court ruled the practice illegal, saying Alonzo King, a suspect arrested on assault charges but tried on an older charge of rape, had "a sufficiently weighty and reasonable expectation of privacy against warrantless, suspicionless searches".

Monday's decision overturns that ruling. Justice Kennedy was joined by Chief Justice John Roberts and Justices Samuel Alito, Clarence Thomas and Stephen Breyer in support for the practice.