A custodian at a northwest suburban YMCA secretly recorded underage girls while they were changing clothes in the women’s locker room, according to Cook County prosecutors.

Elizur Gomez, 34, was charged Tuesday with two felony counts of unlawful video recording for filming the teens as they changed out of their swimsuits after a swim meet, the Cook County state’s attorney’s office said in a statement.

Gomez works as part of a cleaning crew at the YMCA in Palatine, prosecutors said. He was working Sunday when he entered the locker room, and one of the victims told him to leave because there were girls changing.

He briefly left, then returned with his cell phone out and its camera pointed at the two teens, prosecutors said.

Gomez then hid in a changing stall and put the camera under a curtain to continue to record them, prosecutors said. The girls eventually noticed him and immediately ran to tell a parent and swim coach.

Gomez, a Palatine resident, was arrested at the scene, prosecutors said. He was ordered held on a $45,000 bond at a hearing Wednesday at the Rolling Meadows Courthouse, and will next appear in court August 8.