A divided Supreme Court bolstered police powers on Monday, ruling that evidence of a crime in some cases may be used against a defendant even if the police did something wrong or illegal in obtaining it.

The 5-3 decision drew heated dissents from liberal justices who warned that the outcome would encourage police to violate people's rights.

The ruling comes in a case in which a police detective illegally stopped defendant Joseph Edward Strieff on the streets of South Salt Lake City, Utah. A name check revealed an outstanding warrant for him.

Police Detective Doug Fackrell arrested Strieff and routinely searched him, finding that he was carrying methamphetamine.

The case raised the question of whether the valid warrant outweighs the stop, which was illegal because Fackrell lacked any reasonable suspicion that Strieff had been violating the law. It was the court's latest case that questions whether evidence should be thrown out of court because the police did something wrong or illegal that led to the discovery of the evidence.

Justice Clarence Thomas said for the court that the officer's actions were not a flagrant violation of the law. "While Officer Fackrell's decision to initiate the stop was mistaken, his conduct thereafter was lawful," Thomas wrote.

But Justice Sonia Sotomayor said in dissent that the decision is a blow to constitutional rights.

"The court today holds that the discovery of a warrant for an unpaid parking ticket will forgive a police officer's violation of your Fourth Amendment rights," Sotomayor wrote, joined by Justice Ruth Bader Ginsburg.

In a portion of her opinion that expressed only her own views, Sotomayor also described the "humiliations" of unjustified police searches and said that "people of color are disproportionate victims of this type of scrutiny."

Justice Elena Kagan filed a separate dissent in which she said the ruling "creates unfortunate incentives for the police — indeed practically invites them to do what Fackrell did here."

The fourth member of the court's liberal wing, Justice Stephen Breyer, joined the four conservatives to form a majority on the eight-justice court.

The issue is especially significant, Sotomayor said, because "outstanding warrants are increasingly common."

In one prominent example, the Justice Department's 2015 report that faulted police practices in Ferguson, Missouri, found that 16,000 of Ferguson's 21,000 residents had outstanding warrants.

Many of those outstanding warrants, like Strieff's, are for unpaid traffic fines — penalties that would not result in jail time.

The argument made by Strieff's supporters is that in places with so many outstanding warrants, officers have a good chance of randomly stopping someone who has not paid a fine for a minor infraction.

But Thomas, in his majority opinion, said that Fackrell's "discovery of the arrest warrant attenuated the connection between the unlawful stop and the evidence seized incident to arrest."