A 19-year-old East Boston High School student who was arrested last week for allegedly making threats at school is in ICE custody after authorities realized he’d been living in the United States illegally since 2015, an ICE official said.

Kevin Vasquez Funes, 19, a citizen of El Salvador living in East Boston, was arrested by Boston police Wednesday after allegedly making threats against people at East Boston High School. Funes, who was enrolled at the White Street high school, was ordered held on $5,000 cash bail during his arraignment Thursday in East Boston District Court on a charge of threatening to do bodily harm, a spokesman for Suffolk District Attorney Daniel F. Conley’s office said. Funes was scheduled to return to court on Wednesday.

Funes was later arrested at his home by U.S. Immigration and Customs Enforcement Friday after officials determined he had been living in the country illegally since 2015, an ICE spokesman said. Funes, the spokesman said, “will remain in ICE custody pending the outcome of his immigration case.”

A Boston Public Schools spokesman said an automated phone call was sent to the school community letting them know that Funes had “made verbal threats of violence toward members of our school community” and that staffers “immediately took action and contacted Boston School Police and the Boston Police Department.”

“We take any potential safety threats extremely seriously; and we do not tolerate students making threats of violence toward our school,” the message continued. “We fully believe that East Boston High School is safe. Boston School Police officers will continue to patrol our school before, during and after the school day.”

The spokesman said in an email that he was unaware that Funes had been detained by ICE and stressed that the district “has strong protocol that advises school leaders to contact Boston Police and the BPS Legal Office if ICE were to ever appear at a school looking to detain an individual.”

“BPS’ mission is to foster a safe and welcoming environment for all students regardless of their backgrounds,” the spokesman said in an email.

Dan Atkinson contributed to this report.