BAKERSFIELD, Calif. (KGET) — An inmate at Lerdo Jail in custody on charges including attempted murder planned an escape earlier this month by using another inmate’s PIN to call an associate on the outside, according to a court filing.

A probable cause declaration says Marcos Rosales told the associate to meet him Aug. 9 at a doctor’s office in Downtown Bakersfield where he was being transported for an appointment.

Upon arriving at the doctor’s office, Rosales blew a “white powdery substance” into the transporting deputy’s face, ran through the parking lot, kicked off his ankle chains and carjacked a nearby motorist, according to the declaration.

The deputy gave chase but lost sight of Rosales. Upon returning to his van, the deputy saw a pepper ball shell that had been opened, and realized he had the remains “of pepper ball powder on his person and stated he felt a burning sensation on his face,” according to the declaration.

Rosales, 34, was arrested three days later and has been charged with five felonies — including assault with a caustic chemical — in connection to the escape. Adrian Diaz, 30, was arrested on suspicion of helping him escape, according to sheriff’s officials. Six others were also arrested during the investigation.

Rosales is held without bail and due back in court Aug. 29.

When taken to the doctor’s office at 2920 F St., Rosales was handcuffed and placed in leg irons and a waist chain, the declaration says. He stepped out of the van then told the deputy he left his face mask inside. He refused to get it.

The deputy walked Rosales to the front of the van to grab another mask. While reaching for it, Rosales turned away, according to the declaration.

“After retrieving the face mask, (the deputy) turned Rosales around where he saw Rosales holding his hands out and open with an unknown white powdery substance,” according to the declaration. “Rosales blew the white powdery substance directly into (the deputy’s) face.”

Rosales then ran.

It’s unclear how Rosales got hold of the pepper ball, a less-lethal weapon that breaks on impact when fired, dispersing a powder that irritates the eyes and nose.

Rosales was originally in custody on suspicion of attempted murder, assault with a deadly weapon, felon in possession of a firearm, possession of methamphetamine for sale and possession of a controlled substance while armed.