Carlos Rodriguez, 36, of Algonquin.

An Algonquin man allegedly committed a sex act upon himself in public which was witnessed by three children near a school in Crystal Lake.

Carlos Rodriguez, 36, of Algonquin, was charged with six counts of public indecency, a Class A misdemeanor.

A criminal complaint filed in McHenry County Circuit Court alleges Rodriguez committed public indecency around 3 p.m. on August 27.

The complaint said Rodriguez committed a sexual act in a public place by actively masturbating with his hand while sitting in his car.

The act was witnessed by three 15-year-old juveniles, the complaint said.

The incident occurred near a public high school in Crystal Lake and in direct view of the public, the complaint said.

The Crystal Lake Police Department arrested Rodriguez and transported him to the McHenry County Jail.

Rodriguez was released from the jail because the charges are non-detainable under the Illinois SAFE-T Act, which ended cash bail.

[Suggested Article]  2 children among 5 injured in crash caused by alleged drunk driver in Fox River Grove

McHenry County Judge Carl Metz ordered Rodriguez to have no contact with any children besides his own and to stay away at least 500 feet from schools.

Rodriguez was also ordered to obtain a sex offender evaluation within 21 days of his release.

Rodriguez is scheduled to appear in court again on September 27 for a plea hearing.