A 33-year-old Cheektowaga man is in custody for allegedly trying to have sex with a 13-year-old girl whose naked photos he was texting to another man through a phone app, Cheektowaga Police reported.

Mark A. Johnpier, of South Seine Drive, was remanded to jail by Cheektowaga Town Justice Paul S. Piotrowski at his arraignment on charges of disseminating indecent material to a minor, promoting an obscene sexual performance by a child, endangering the welfare of a child and obscenity in the third-degree. Police said Johnpier was arrested Thursday after a weeks-long investigation.

Cheektowaga detectives found Johnpier had made contact with the and was texting her photos to another man. The detectives took over the girl’s account and found Johnpier continually texting them, asking to have sex with what he still believed to a 13-year-old girl. He also sent her photos to a friend, police said.