The homeless man stood in a public bathroom, waiting to be handcuffed.

But John Rabago, a Honolulu police officer, waved a get-out-of-jail-free card. He told 37-year-old Samuel Ingall that he could avoid arrest — but only if he was willing to humiliate himself and potentially expose himself to all kinds of alarming bacteria in the process.

“If you lick the urinal,” Rabago told him, “you won’t get arrested.”

The January 2018 confrontation sparked a federal investigation that concluded on Monday, when Rabago, 43, pleaded guilty to conspiring to deprive Ingall of his civil rights. Though the cop had initially claimed his comments were a joke that got misconstrued, a former Honolulu police officer, Reginald Ramones, also 43, who pleaded guilty in September and promised to testify against Rabago, said that the threat was entirely serious.

And Ingall evidently took it literally: He reluctantly agreed to lick the public toilet so that he could avoid going to jail, prosecutors say.

The homeless man made a habit of cleaning up in one particular public bathroom in a busy Honolulu shopping district. He was there so often that a sympathetic employee would unlock the bathroom for him, Hawaii News Now reported. But on Jan. 28, 2018, someone objected to his presence and called the police with a nuisance complaint.

Rabago was the first of five officers to show up. In court on Monday, he said that Ingall was uncooperative and gave him a fake name, while telling him that he would do anything to avoid being arrested.

Relatives of Ingall have said that he struggles with drug addiction and has been in and out of jail for most of his adult life. A 2016 documentary about Hawaii’s homelessness crisis captured him being released from prison and promising to turn his life around. “I’m ready to work immediately,” he told the camera crew. “I don’t want to risk going back to prison and selling drugs on the street.”

Ingall checked into a homeless shelter, the documentary showed, but within a matter of days, he was hospitalized after overdosing on crystal meth. His family told Hawaii News Now that he had been let out into the street “with no ID, nothing,” after his release from prison, making it impossible for him to apply for permanent housing. His mother suggested that he could have avoided petty disputes with police if he was receiving the help that he needed.

After his January 2018 run-in with the Honolulu Police Department, Ingall reportedly told his sisters that the officers had forced him to sit in urine and shoved his head into the toilet. “He says he wasn’t resisting arrest,” Mary Ingall told Hawaii News Now. “They hit him with a stick on his left arm. He has a big bruise.”

In Rabago’s plea agreement, he acknowledged that he repeatedly told Ingall, “in an aggressive tone,” that the only way he wasn’t getting arrested was if he licked the urinal. By then, Ramones had arrived on the scene, and Rabago told him to close the door behind him. Then, he repeated his order again.

Ingall “reluctantly knelt down before the urinal” and licked it, the plea agreement states. Rabago allowed him to gather his possessions and go, then followed him out of the bathroom. He laughed as he told the other officers waiting outside about what he made the homeless man do.

“He was forced to essentially do something that’s disgusting,” Myles Breiner, Ingall’s attorney, told KHON in April. “His face was forced into a urinal. The police officers thought this was amusing. It wasn’t as though he was doing anything illegal but they chose to do this to him because he was vulnerable.”

The homeless man didn’t come forward to tell authorities about what happened. But one of the officers who had been waiting outside the bathroom informed his bosses, sparking a federal investigation, Hawaii News Now reported.

“That officer should be commended,” Honolulu Police Commission Chairwoman Loretta Sheehan told the outlet. “As a member of the public, I thank him or her from the bottom of my heart. This is the kind of stuff we need to continue to do at HPD to maintain the highest level of integrity there.”

Both Rabago and Ramones were arrested last April and pleaded not guilty. Megan Kau, Rabago’s attorney, told KHON in April that the officers had been “joking around” when they made a comment about licking a toilet bowl and that the other officer “took it the wrong way.”

But Ingall’s family maintained that he was telling the truth. “We know our brother. We know when he lies. We know when he’s being dishonest,” his sister, Mary Ingall, told Hawaii News Now. “And he was very sincere and very detailed and it never changed, what he said.”

In September, Ramones changed his tune, pleading guilty to a lesser charge of withholding information about a crime, and promised to testify against Rabago in court. In his plea agreement, he detailed how his former co-worker told him to shut the bathroom door so that the incident wouldn’t be captured by a security camera, and said that Rabago later instructed him to delete their text messages and coached him on how to lie to investigators.

Ramones also said that before the January 2018 incident, he watched Rabago confront another man in the bathroom of a public park, telling him that unless he stuck his head in the toilet, he would be arrested. The man reluctantly agreed, he said.

Kau told Hawaii News Now on Monday that Rabago was “very remorseful, which is why he took responsibility.”

Both defendants are slated to be sentenced in February and face fines up to $250,000. Ramones, who reportedly left the Honolulu Police Department in August, could be sentenced to up to three years in prison, though the government is expected to recommend he only receive probation. Rabago faces up to 10 years in prison. According to Hawaii News Now, he is on leave from the Honolulu Police Department and expects to be fired now that the case has concluded.