A janitor at a Chester County middle school attempted to coax two female students into a sexual relationship by sending them explicit text messages and giving them gifts, prosecutors said Tuesday.

Rushon Drayton, 23, told detectives when questioned that “age is only just a number,” according to the affidavit of probable cause for his arrest. Drayton, of Paoli, has been charged with institutional sexual assault, indecent assault of a person under 16, corruption of minors, and related offenses.

He was released after posting $50,000 bail. There was no indication he had hired an attorney, and he did not return a request for comment.

Investigators in Tredyffrin Township were contacted by the mother of one of the girls earlier this month when she learned that Drayton was having inappropriate contact with her 14-year-old daughter, the affidavit said. She told police her daughter met Drayton at Valley Forge Middle School, where she attends classes and where he works as a janitor.

Detectives learned that Drayton had befriended the girl, giving her candy and walking her home from school. In February, they exchanged cellphone numbers, and police discovered that he had begun sending her sexually explicit text messages.

Another girl at the school told detectives the 14-year-old was “in a relationship” with Drayton, the affidavit said. The second girl, 15, also received explicit messages from Drayton, including pictures of his penis and videos of him masturbating, she told police. Drayton gave the 15-year-old various gifts, including marijuana and sex toys, the affidavit said.

In an interview with police, Drayton admitted that he kissed the 14-year-old at least 10 times but denied having any further physical contact with her. When detectives searched Drayton’s phone, they discovered hundreds of sexually explicit text messages he had exchanged with the 15-year-old, including messages in which he asked her to have sex with him, the affidavit said.

He also searched online for “cheap hotels,” as well as for “how long someone would go to jail for ‘messing with an underage girl,’” according to the affidavit.