A man hid his cellphone to videotape his girlfriend’s young daughter and son in the bathroom of their Albany Park home, prosecutors say.

On Tuesday, Alberto Garcia, 27, went in to the bathroom of the home he shares with his girlfriend and her two children in the 3700 block of West Agatite, activated the video recorder on his phone and hid it in a trash can, prosecutors say, then put toilet paper around the phone to hide it.

The recording captured his girlfriend’s 9-year-old son as he entered the bathroom, urinated and left, prosecutors said.

A few minutes later, the 12-year-old girl was recorded entering the bathroom and using the toilet, prosecutors said, but she heard a noise from the trash can, found the phone and stopped the recording.

The girl took the phone to her grandmother’s home nearby, according to prosecutors. She viewed the recording and told her mother, and the mother called police.

Garcia was charged with child pornography and unlawful videotaping and held on $200,000 bail.

In July, the girl had found Garcia’s phone hidden in a clothes hamper while she was in the bathroom, according to court records, and saw a video on the phone that showed her naked entering and exiting the shower.

She deleted the video and reported it to a school official, prosecutors said. Garcia denied any wrongdoing, and the investigation was closed.

Garcia was arrested Wednesday and admitted he hid the phone in the bathroom to record the girl because he was “sexually attracted to her,” prosecutors said. He admitted he had hid the phone in the bathroom and recorded videos of her four or five times but later deleted the videos.

He also admitted to recording the July video the girl found, prosecutors said.

His cellphone was sent to a forensic laboratory to try to recover the deleted videos, prosecutors said.