A missing 16-year-old California girl has been rescued from a 23-year-old man who allegedly molested her while holding her against her will after they were caught riding a train without tickets by fare inspectors, police said Thursday.

Merced Pacheco, 23, from Santa Clara, and the girl were stopped by fare inspectors on the Valley Transportation Authority light rail system on Tuesday and were forced to get off the train at a North San Jose station after being unable to produce valid tickets.

The girl eventually confided to an inspector that Pacheco was holding her against her will and rail staff called police, the San Jose Mercury News reported.

Police determined that the girl had been reported as a missing person from San Jose.

Sgt. Jose Cardoza of the Santa Clara County Sheriff's Office said the girl had been living with Pacheco for a "couple of months" but it was not currently known for how long she was held against her will, local news site Gilroy Patch reported.

While not identifying the girl because she is a minor and the victim of a sex crime, police said she is not missing South Bay teen Sierra LaMar.

"Thanks to the swift action and keen situational awareness of the two fare inspectors, deputies were able to respond quickly to the incident that was unfolding, which we hope has prevented a heinous crime from continuing," Capt. Robert Schiller of the Sheriff's Department said.

Pacheco has been charged with two counts each of raping, sodomizing and sexually penetrating a minor over 14, two counts of lewd acts with a minor over 14, and two counts of criminal threats, the Mercury News reported.