A Minneapolis man was sentenced three years of probation Tuesday for drug possession, in a case that attracted legal challenges after police obtained a search warrant to remove the drugs he had hidden in his rectum “by any means necessary.”

In addition to the probation, Guntallwon Brown was sentenced by Hennepin County Judge Lyonel Norris to 90 days of home confinement and ordered to take a drug test. A jury found Brown guilty of fifth-degree possession at the end of a three-day trial earlier this year.

The case revolved around Brown’s Aug. 8, 2015 arrest after Minneapolis police officers, acting on a tip, took him into custody and brought him back to Third Precinct headquarters to be searched and questioned.

Suspecting that Brown had hidden the drugs in his rectum, the officers obtained a search warrant to recover the drugs by “any means necessary.”

At their first stop, North Memorial Medical Center, a doctor refused to perform a procedure to remove the drugs on ethical grounds.

Police then obtained a second warrant and drove Brown to Hennepin County Medical Center, where they found a physician who was willing to perform the procedure. The doctor found a baggie containing just under three grams of crack cocaine in his anal cavity and he was charged with possession.

A spokesman for the Hennepin County attorney’s office on Tuesday declined to comment on the sentencing.

Brown’s public defender argued unsuccessfully at trial to suppress the drugs on the basis that they were seized in violation of the Fourth Amendment. The motion was denied.

“I was really limited by the judge and what I could argue at the trial,” said Hersch Izek, of the Legal Rights Center. “I told them to follow the law, but temper that with a sense of justice given the circumstances of the case.”

He said he expects Brown to appeal.

“The purpose of the appeal is that the cops won’t do this again, and hopefully change hospital policy as far as what they do when presented with a search warrant,” he said.