A teenager in Utah who had expressed support for the Islamic State group (ISIS) has been arrested after bringing a bomb to his high school, local police say. The bomb failed to detonate.

The investigation began just after noon on Monday when students at Pine View High School in St. George found a backpack which had smoke coming from it, causing the school to be evacuated. The bomb squad later determined that it contained an explosive device.

St. George is a city about 108 miles (174 kilometers) northeast of Las Vegas.

Police said on Tuesday that the bomb, which was placed near a vending machine and was disarmed safely, had the “potential to cause significant injury or death” if it had successfully detonated. Other details about the device were not immediately released.

A male student who was attending a class at Pine View High School was identified as a suspect. Investigators searched his home and found items consistent with the materials used to build the bomb, according to officials.

“Based on our investigation we can confirm this was a failed attempt to detonate a homemade explosive at the school,” police said in a statement. “It was also determined that the male had been researching information and expressing interest in ISIS and promoting the organization.”

The student, whose name and age were not released, is also a suspect in an incident at a high school in the neighboring city of Hurricane, where the American flag was replaced with the ISIS flag, along with graffiti saying “ISIS is comi–.”

The suspect has been charged with the manufacture, possession, sale, use or attempted use of a weapon of mass destruction. More charges are pending, to include charges from the incident which occurred at the Hurricane High School.

“There were several factors that came into play yesterday which led to a positive outcome,” police said in their statement. “We’d like to recognize and thank the students who notified faculty and the [school resource officer] of the suspicious backpack. Their immediate action played a large role in this incident ending with no injuries.”