Police in San Antonio have arrested a 27-year-old man on charges that he exposed himself inside a public library, grabbed a child on her buttock and, apparently, masturbated.

The man, Ray Ortega, has been charged with indecency with a child, reports KSAT-TV, the local ABC affiliate.

The incident occurred on Wednesday.

Ortega was seated at a computer terminal inside the on San Antonio’s Southwest Side and the girl was sitting with her mother at a terminal across from him, according to a police affidavit obtained by the San Antonio Express-News.

At some point, police say, Ortega turned toward the little girl and grabbed her. The next thing that happened, according to the affidavit, is that Ortega pulled down his pants and began performing some unspecified sex act — in front of the girl and other children (and adults).

Ortega sought to make eye contact with the girl, police said.

The girl’s mother was using the computer and did not see what was happening.

The girl told her mother what she witnessed after leaving the library. The mother called the library, which in turn contacted police.

Bexar County spokeswoman Laura Jesse described Ortega as “a regular patron” of the library, according to KSAT.

As such, library staffers were able to access surveillance camera footage which captured the disgusting episode in full.

The library also had contact information concerning Ortega. He had provided driver’s license information in order to use a computer terminal. Staffers gave Ortega’s information to police.

Sheriff’s deputies arrested Ortega later in the day on Wednesday.

His bail was set at $15,000.

It’s not clear if Ortega has posted bail, or if he remains incarcerated.

Follow Eric on Twitter. Like Eric on Facebook. Send story tips to erico@dailycaller.com.