Authorities said Wednesday they have identified the teenager engaged in a videotaped sexual encounter with a Foxboro High School teacher facing federal child pornography charges.

The individual is an 18-year-old boy who special education teacher Thomas Davis, 41, met through a gay dating app for consensual sex, a prosecutor said during a court hearing.

However, the teenager, who is not from Foxboro, was not aware Davis had allegedly secretly videotaped the encounter, Assistant U.S. Attorney David Tobin told the court during a video hearing.

Authorities tracked down the individual, who was not named, after Davis was arrested last Thursday by the FBI on charges of possession of child pornography and receiving child pornography, Tobin said.

No new charges were filed.

But Tobin said the case remains under investigation to determine if Davis had more than the 40 images of alleged child pornography on his laptop, iPhone and other electronic devices seized after his arrest.

The prosecutor told the court three of the images were of boys between ages 4 and 8 being sexually abused by naked adult men in their 40s. He said authorities believe the other images would be similar.

“The images are very disturbing, very troubling,” Tobin said, adding that they were downloaded from the internet over diverse days but were kept on the defendant’s computer.

“It’s clear the defendant is sexually attracted to children,” Tobin said.

Davis’ arrest came after another man he met on the gay dating app told law enforcement authorities Davis showed him the sex tape and told him the boy on the tape was one of his students, Tobin said.

However, public defender Julie-Ann Olson told the court that Davis denies making that statement. She said the individual on the sex tape was not a student of Davis’ at any time during his career.

Davis, of 135 Central St., in Mansfield, is on unpaid administrative leave from his special education teaching position in Foxboro and is a former teaching assistant in Sharon.

He is currently being held at the Plymouth House of Correction without bail and appeared for the detention hearing on video.

Federal prosecutors want to keep Davis behind bars while the case is pending. A public defender asked that he be released with a GPS bracelet to the custody of his father and stepmother in Kansas.

The hearing was continued to Tuesday, Sept. 7, so the probation department can assess the arrangements proposed by Davis, who is from Olathe, Kan., a city south of Kansas City, Kan.

During the hearing, Tobin told Magistrate Judge David Hennessy Davis should be kept in jail while the case is pending because he is a danger to the community and may not appear in court if released.

“We’re concerned that the activity could continue and intensify,” Tobin said.

Although Davis has no prior criminal record, Tobin said, he faces a mandatory minimum 5-year prison sentence if convicted.

Even though the individual in the sex tape was 18, Tobin said investigators who viewed the tape and the individual Davis showed it to believed the person was younger.

The case is concerning because Davis was a teacher, Tobin said, noting that about 200 people in Foxboro attended a community meeting held to answer questions about the case.

In response to the prosecution’s request, Olson argued Davis has the support of his family in Kansas and that there are no children in the home of his father and stepmother.

Although Hennessy said he has not made any decision on the case, should he release Davis the defendant would be under house arrest with a GPS bracelet and his travel to Kansas would have to be monitored.

Davis would have to continue counseling for anxiety and depression, and guns that are in his father’s house in Kansas would have to be removed, Hennessy said.

The magistrate judge also wanted to prohibit Davis’s access to the internet. Olson said Davis’s father and stepmother could have their devices password protected.

David Linton may be reached at 508-236-0338.