HAYWARD, Calif. (AP) — A disgraced California police officer at the heart of a police department sex scandal involving a teen prostitute behaved "like a pimp" with her, a judge said at hearing in which he ordered the former officer to be tried on a felony charge of obstruction of justice.

Brian Bunton, who resigned from the Oakland Police Department in March, "was actually pimping her like a pimp would do," Alameda County Superior Court Judge Thomas Rogers said Thursday.

The judge also ruled that Bunton, 41, would be tried for engaging in prostitution, a misdemeanor.

The judge made the decision after the former prostitute, who is now 19, testified said she was sexually exploited by 29 police officers.

Prosecutors have six charged current and retired officers for their alleged involvement with the teen, including several from Oakland. Two have pleaded guilty.

Bunton coached her on how to be a better prostitute, telling her what neighborhoods to go to seek clients and warned her about what she thought was an upcoming undercover police sting, she testified. She vomited into a trash can while testifying about describing sex acts with Bunton.

The Associated Press doesn't generally name alleged victims of sexual crimes.

Bunton's lawyer, Dirk Manoukian, agreed that his client is guilty of misdemeanor prostitution but said he is not guilty of the felony obstruction charge, the East Bay Times reported (http://bayareane.ws/2r13TKU).

The alleged victim said she met Bunton one night in February 2016 when she got lost one in Oakland. He was on duty, called her a taxi and the two exchanged numbers.

Text messages and requests for nude photos by Bunton came later and the two had sex in a hotel in March, she testified.

At one point, she said, Bunton joked she should "show more skin to get clients" on her online classified ads.

Bunton also texted her to say she needed a "better manager" so she could make more money as a street prostitute, she testified.

She testified she threatened to report Bunton to police internal affairs investigators after learning he was part of what she described as a "club" of officers who had sex with her and shared information about it with each other.

The woman said in court that she started working as a prostitute at age 12 but has quit.

She is the daughter of an Oakland police dispatcher.