LOS ANGELES (CBSLA.com) — A 41-year-old man accused of posing as a police officer was charged Monday with kidnapping and raping a 15-year-old girl as she walked home from school.

Prosecutors say Joseph Kenneth Cornett committed the crime knowing he was HIV positive.

Lancaster police say the attack happened Wednesday after Cornett approached the victim and arrested her for jaywalking. He then took her inside an abandoned mobile classroom near Lancaster Boulevard and 40th Street and sexually assaulted her.

Cornett pleaded not guilty Monday to nine felony counts: one felony count each of kidnapping to commit rape, assault with intent to commit a felony with a victim under 18, kidnapping, lewd act upon a child, false imprisonment by violence, sexual penetration by foreign object with a minor over 14, attempted forcible rape, assault by means likely to produce great bodily injury and attempted unprotected sexual activity by one who knows self to be infected by HIV, the Los Angeles County District Attorney’s Office said.

He also faces seven misdemeanor counts of resisting a peace officer, and one misdemeanor count of possessing a controlled substance, PCP.

Officials said the girl escaped and approached a parent leaving Lancaster Baptist Church across the street.

“The girl approached the car and explained that she had been attacked. At that same time, the assailant was coming across the road, as well,” church employee Ben Hobbs said. “We’re seeing this guy heading back toward those modular buildings, trying to get away, basically.”

Witnesses say Cornett attempted to flee. Several good Samaritans tried to stop him, but he managed to get into his car.

He was apprehended by police when his vehicle became stuck in sand.

“How he ended up where he ended up, I don’t know. Other than that’s God’s hand, I think,” Hobbs said.

Cornett reportedly put up a fight with officers and spit at them before being restrained and taken into custody.

He’s being held on more than $1.2 million bail.

If convicted, he faces a possible maximum sentence of life in state prison, the District Attorney’s Office said.

Court records show Cornett was on probation at the time of his arrest. He has prior convictions for embezzlement and DUI.

Lancaster Baptist Church officials say the mobile classrooms were dumped several months ago across from them in vacant land without warning. They say they’ve been trying to work with the county to get them removed because they feared they would attract criminal activity.