A Honolulu police officer admitted Monday that he instructed a homeless man to lick a public urinal if he wanted to avoid being arrested.

John Rabago was charged earlier this year with conspiring to deprive the man, identified in court documents as S.I., of his civil rights in connection with the Jan. 28, 2018, incident in Honolulu.

Rabago originally denied the accusations, but admitted Monday in court that he told the homeless man that he would not be arrested if he licked the urinal, according to NBC affiliate KHNL in Hawaii. The man complied, Rabago said.

Officers were responding to a nuisance complaint when they found the homeless man in a public restroom, according to court documents. Rabago and Officer Reginald Ramones were in the bathroom with the man when Rabago repeatedly instructed him to lick the urinal, then told Ramones to close the door so that a camera would not catch what happened next, court documents said.

"Once defendant Ramones closed the bathroom door, co-defendant Rabago again instructed S.I. to lick the urinal. S.I. then reluctantly knelt down before the urinal and licked the urinal. Co-defendant Rabago then allowed S.I. to gather his possessions and leave the bathroom," court documents said.

Rabago followed the homeless man out of the bathroom, and laughed as he told officers outside about what had just happened.

He said "the incident was 'just like what happened at Cartwright Field'" when he had told a "man that he would avoid arrest only if he stuck his head in a toilet," according to court documents.

Later, Rabago and Ramones learned that the department and the FBI were investigating what had happened. Rabago told Ramones to delete text messages about the incident and tell investigators that he was joking when he told the homeless man to lick the urinal.

Ramones was also charged with conspiring to deprive the man of his civil rights, but pleaded guilty to lesser charges earlier this year after agreeing to cooperate with investigators. He left the department in August.

Meanwhile, Rabago has been on restrictive duty, and is expected to be fired. He could be sentenced to 30 months in prison.

“Justice has prevailed because John Rabago has admitted that he violated the victim's constitutional rights,” Rabago's attorney Megan Kau said Monday, according to KHNL. “He’s very remorseful, which is why he took responsibility.”

The homeless man, identified by his family as Samuel Ingall, has been in and out of prison and was featured in a documentary about Hawaii's homeless crisis called "No Room in Paradise," according to KHNL.

Ingall was shown in the documentary checking into a homeless shelter and vowing to clean up his act, but he quickly ended up hospitalized for a crystal meth overdose.

His family told KHNL that he was not familiar with the officers who approached him, and was not sure why they surrounded him in a bathroom he often used because an employee would leave the door unlocked for him.

The family alleged that the officers also hit Ingall, "made him sit in pee" and forced his head into a toilet.

"He just said that they put him in the water and that he couldn't breathe and that he was choking when they brought him up," his sister, Mary Ingall said.