An Alameda County Superior Court judge Thursday ordered a former Oakland police officer charged in a police-misconduct scandal to stand trial after saying the officer behaved “like a pimp” in his dealings with a teen prostitute.

Judge Thomas Rogers chastised Brian Bunton, saying Bunton was “compromised” after having sex with a teen because she knew he was an officer and could ask for favors in exchange for her keeping quiet.

“He’s actually pimping her like a pimp would do,” Rogers said after ruling that there was sufficient evidence for Bunton, 41, to be tried on charges of obstruction of justice and engaging in prostitution.

The 19-year-old Richmond teenager, who previously used the name Celeste Guap and now goes by Jasmine, testified that Bunton coached her on how to be a better prostitute and warned her of what she thought was an imminent undercover police operation.

Her appearance at the Hayward Hall of Justice marked the first time she testified in a case related to a wide-ranging prostitution scandal that rocked Bay Area police departments last year.

The hearing came after nearly two months of disputes in court between the Alameda County district attorney’s office and the Oakland city attorney over what police personnel files Deputy District Attorney Sabrina Farrell could obtain, the prosecutor said.

Jasmine said she met Bunton in February 2016 when she got lost on the streets of Oakland at night and Bunton was on duty as an Oakland police officer. They exchanged numbers and he called a taxicab for her to get home to Richmond, a move for which she nicknamed him “Superman.”

Jasmine testified that she and Bunton began texting back and forth soon after they met, conversations she described as “therapeutic, sexual and friendly.” On several occasions, she testified, Bunton asked her to send him nude photos of herself.

At one point, Jasmine said, Bunton told her that “the 20s weren’t popping,” meaning that streets near 20th Avenue and International Boulevard had fewer men looking for prostitutes. She said that he encouraged her to continue soliciting men around 40th Avenue.

Jasmine’s pimp rented out a room for her at the Marriott Hotel near the airport for the weekend of March 5 last year when Bunton came by after a patrol shift and brought her coffee, she said. She testified that Bunton took her cell phone and deleted their text message conversation before they engaged in oral copulation.

The visibly nervous teen vomited into a trash can on the witness stand after describing the sex acts.

She also said that during that encounter, he joked about her sex advertisement on the classifieds website Backpage.

“He said I should show more skin to get clients,” Jasmine told the courtroom.

He left the hotel about an hour later and texted her which streets to steer clear of to avoid undercover police officers conducting a prostitution sting. But Lt. Jill Encinias, who heads the Police Department’s special victims unit, said there was no such operation that weekend.

During subsequent texting conversations — copies of which Oakland detectives obtained amid an internal-affairs investigation — Bunton asked Jasmine how much money she made. When she said “not as much as I wanted to,” he suggested she needed a “better manager.”

Farrell told The Chronicle that there’s an active warrant out for the arrest of Jasmine’s pimp.

Jasmine said she grew frustrated with her relationship with Bunton after another police officer told her that Bunton was part of a “club” of officers who had sex with her and talked among themselves about it. She said she threatened to go to internal affairs and “snitch” on him.

Under questioning from defense attorney Dirk Manoukian, Jasmine said that Bunton texted her that he actually lied about the undercover operation “just to keep you off the streets.”

Farrell implied that Bunton may have heard about a different police action and mistaken it to mean a prostitution sting.

Had there been a real operation, Encinias said, the consequences of Bunton’s information sharing could have been deadly. She described recent operations in which undercover officers had been stabbed, shot at or nearly run off roadways by pimps when their covers were blown.

Jasmine is the daughter of an Oakland police dispatcher and worked as a prostitute for about six years before meeting Bunton, at which time she was 18. She told The Chronicle that she had sex with 29 law-enforcement officers in the Bay Area.

She said some of the interactions happened when she was underage. Some of the officers paid her, she said, and others tipped her off about undercover operations or ran the names of people she knew through law-enforcement databases.

The Alameda County district attorney’s office has charged six men with crimes in the case. Two have taken plea deals. The dispute with City Attorney Barbara Parker’s office led to a six- to eight- week delay in all the Oakland cases, Farrell told The Chronicle.

Jasmine said Thursday that she learned police jargon from her mother and that she and Bunton would tell each other when they were “922” or drunk.

Jasmine said she found out that Bunton and another Oakland police officer with whom she was having sex, Terryl Smith, were talking about her and their interactions with her — which the teen said made her worried.

That was shortly before internal-affairs investigators initiated their wide-ranging misconduct review. Smith was one of the six men charged.

Outside of court, Bunton’s attorney declined to comment on the case.

Kimberly Veklerov is a San Francisco Chronicle staff writer. Email: kveklerov@sfchronicle.com Twitter: @kveklerov