HAYWARD — An Alameda County judge on Thursday compared a former Oakland police officer to a pimp before ordering him to trial on a felony charge based on testimony from a teenager who claims she was sexually exploited by some 30 Bay Area police officers.

“He’s actually pimping her like a pimp would,” Judge Thomas Rogers said at the preliminary hearing for former Oakland Officer Brian Bunton. Rogers ruled Thursday that there is enough evidence to send Bunton to trial for felony conspiracy to obstruct justice and misdemeanor engaging in prostitution.

The 19-year-old woman at the center of the sex scandal fidgeted and pulled on her hair in apparent nervousness as she testified for the first time in court since seven current and former Bay Area police officers were charged with crimes related to her last year. Her finger trembled as she identified Bunton in court. She vomited into a garbage can by the witness stand after describing a hotel room encounter with the defendant and then kept on testifying.

The sex scandal roiled Bay Area law enforcement agencies last May when allegations that she had sex with around 30 Bay Area officers first became public. Oakland police Officer Brendan O’Brien committed suicide and left a note implicating other officers in September 2015, but the investigation was not made public for several months. The daughter of an Oakland police dispatcher, the young woman has filed multimillion dollar claims against Oakland, Richmond and other municipalities alleging police misconduct and sexual exploitation.

On cross-examination, the 19-year-old woman, whose name is not being published by this newspaper because she was a sexually exploited teenager, admitted that she and Bunton never agreed to exchange sex for information or anything else of value. Bunton was a patrol officer for less than two years before his arrest. He resigned in March.

Judge Rogers said Bunton was compromised as an officer as soon as he had sexual relations with the teen.

“When she said that there wasn’t agreement, that was a legal conclusion,” Rogers said. “She knew what she was getting out of it. He knew what he was getting out of it.”

The teen testified that she worked as a prostitute for six years, beginning when she was 12 years old.

“I was a prostitute,” she said. “I accepted money, I accepted clothes, I accepted drugs.”

She said she was 18 when she met Bunton in February 2016 while she was lost on the streets of Oakland and he was on patrol with a second officer. She and Bunton exchanged phone numbers before he sent her home to Richmond in a cab, for which she dubbed him “Superman.”

About a month later, after many “therapeutic, sexual and friendly” texts and phone calls, Bunton showed up at an Oakland hotel room that a pimp had rented for the weekend at 7:30 a.m. after his overnight shift. She testified that he deleted their previous text conversation from her phone during the visit.

They had oral sex, and after he left, he texted her information about an undercover prostitution sting planned on International Boulevard, she said.

“Thank you, daddy, I appreciate it, I don’t want to go to jail,” she said she replied.

The teen said that a few days later, Bunton texted her to ask if she made as much money as she wanted that weekend. She replied not as much as she wanted.

“He told me I needed a better manager,” she said.

The relationship between Bunton and the teen soured when she came to believe that he was talking about her with other police officers she had sex with and learned that there had been no undercover operation the night he said. She hammered him with text messages and threatened to hand her phone over to police internal affairs.

“I lied about the (undercover prostitution sting) part just to keep you off the streets,” Bunton allegedly wrote in a text message to the teen. “You are the daughter of a dispatcher. I thought that was the least I could do to keep you off the streets.”

Defense attorney Dirk Manoukian argued that Bunton is guilty of misdemeanor prostitution but that he’s innocent of conspiracy.

Bunton returns to court June 5 for an arraignment.