Police say Carlos Tellez was found masturbating in his car in unincorporated San Leandro, allegedly trying to attract passing trick or treaters.
Deputies found Tellez sitting in his gold 1998 Mazda Protege with his pants unzipped and pulled down to mid-thigh and his shirt pulled up to mid-chest.
He had been placed under citizen's arrest by a passer-by, and was detained without incident.
Tellez, an art teacher for the Livermore Valley Charter Preparatory in the city of Livermore, told deputies he was trying to relax after a stressful day of teaching.
Investigators are looking for other possible witnesses or victims. Members of the public should contact the Special Victims Unit at (510) 667-3645 or call the anonymous tip line at (510) 667-3622.
(ABC7 contributed to this report)