The investigation into a Jersey City substitute teacher charged with sexually assaulting a 14-year-old student began when the teacher’s children confronted her last month and said they were disgusted by her alleged relationship, according to documents released Wednesday.

Elyes Castillo, 45, is charged with aggravated sexual assault, endangering the welfare of a child, witness tampering and having sex while she had a venereal disease without the informed consent of the alleged victim, the criminal complaint says.

Castillo appeared in court for a detention hearing and didn’t utter a word. She hung her head to hide her face as she was escorted out of courtroom after the 15-minute hearing. The alleged victim was not in court.

On Aug. 19 the Division of Child Protection and Permanency was contacted by the father of Castillo’s two children. He alleged Castillo had abused their children, who are 13 and 14, during an altercation, the criminal complaint says.

The complaint says that altercation happened after the children told Castillo they were disgusted by “her relationship with a minor,” which is believed to have gone on for 15 months, the complaint says.

The alleged victim was then interviewed and told investigators that he met Castillo when he was in sixth grade in 2018. He said they began a relationship and “we would make love,” the complaint says.

In the complaint, the boy said he and Castillo had encounters on multiple occasions at Castillo’s Pavonia Avenue residence, with the last incident occurring on Aug. 2, and that they performed multiple sex acts. A warrant for her arrest was signed on Aug. 29 and she was then taken into custody.

At Wednesday’s hearing, the state moved to detain Castillo until her trial. Hudson County Superior Court Judge Paul DePascale sided with defense attorney Johnny Cardona and ordered Castillo released, but barred her from having contact with juveniles, with the exception of her own children. Castillo had been in jail since her arrest.

“I think it’s reasonable under the circumstances to bar her from having any contact with children under the age of 18,” DePascale said in court.

Hudson County Assistant Prosecutor Barbara Drasheff had argued that Castillo should be jailed through the course of her prosecution because nothing could prevent her from being a danger to the alleged victim.

She also argued that the case against Castillo is strong, includes a confession and that she faces 10 to 20 years in prison if convicted.

Cardona pointed out that Castillo has no criminal record, she received the lowest possible score on her Public Safety Assessment and that an order barring her from having any contact with the boy would suffice to keep him safe.