A middle school teacher and girls’ softball coach in Kentucky who is accused of seeking sex with a 14-year-old girl was ordered held in federal custody by a judge ahead of his trial, prosecutors said Tuesday.

Brandon Lee Dietz, a 37-year-old teacher for Jefferson County Public Schools, was ordered by US Magistrate Judge Regina Edwards to remain behind bars for attempting to entice a minor to engage in sexual activity, according to the US Attorney’s Office for the Western District of Kentucky.

Dietz, who was placed in the custody of the US Marshals Service on Friday, contacted an undercover investigator who was posing as a 14-year-old girl in November and requested that she send lewd images to him, as well as a request to meet in person to engage in sex acts, according to a criminal complaint filed on Nov. 30.

Dietz also sent two images of himself to the undercover investigator during a conversation that began late Nov. 20 and continued through the next day. Dietz then agreed to meet the undercover agent on Nov. 21 in Jeffersontown, prosecutors said.

While in a blue Honda Civic, Dietz later drove past an unmarked law enforcement vehicle in the area where he arranged to meet the detective and texted the undercover agent to indicate that he believed he was being “set up,” prosecutors said.

Dietz then identified areas where unmarked law enforcement vehicles were set up, prompting authorities to move the cars before Dietz entered a subdivision where the meeting had been previously arranged, prosecutors said.

Dietz turned around immediately upon seeing the law enforcement vehicle he had just identified and fled the neighborhood at a high rate of speed. He then blew past a stop sign before being taken into custody, authorities said.

Dietz later admitted traveling to meet the person he thought was an underage girl after having a sexually charged conversation and acknowledged that he intended to have sex with a minor, prosecutors said. Several condoms were also found in his Civic, according to an arrest report obtained by the Louisville Courier Journal.

Dietz, according to his LinkedIn page, teaches career choices and consumerism at Frederick Law Olmsted Academy North.

“I have a wide variety of skills and am looking for people to come in to my classes and talk to my students about their career, the path they took to get there, and the education needed to be successful,” his profile reads.

Dietz also coaches the Louisville Glory, a girls’ softball team, according to the Louisville Courier Journal.

A spokeswoman for Jefferson County Public Schools has told the newspaper that the district “will take any steps necessary” as they review the allegations. Dietz remains out of the classroom since his arrest, a spokeswoman told WAVE.

Dietz, meanwhile, had been arraigned on a state charge of seeking sex with a minor and pleaded not guilty before being released on house arrest. He later appeared in federal court on Friday on a charge of attempting to entice a minor to engage in sexual activity and was ordered held behind bars, the Courier Journal reports.

The US Attorney’s Office in Louisville said the federal charges were brought as part of “Project Safe Childhood,” a nationwide effort launched by the Department of Justice in 2006 to curb child sexual exploitation and abuse.