Indiana police say a phone tip has helped prevent an armed 14-year-old from committing a school shooting.
As the student was en route to the Dennis Intermediate School on Thursday, the Richmond school district received a warning call and initiated a lockdown.
"Someone knew something, and they said something," Indiana State Police Sgt John Bowling told reporters.
No students were injured and the suspect died from an apparent self-inflicted gunshot wound, police said.
The incident occurred in Richmond, Indiana, 70 miles (110km) east of Indianapolis, on Thursday morning as classes were just beginning for the day.
As the attacker arrived at the school, he was confronted by police who had rushed to the scene after school officials had alerted police to the phone tip.
When the shooter tried to enter the school, he found the doors locked and shot out a window to get inside.
He then "ran inside with police officers in pursuit," Indiana State Police said in a statement.
After exchanging fire with police, the suspect was found in a stairwell from what police believe was a self-inflicted gunshot wound.
Police have yet to release the attacker's name, potential motive, how many weapons he was carrying or whether he may have been injured by police before killing himself.
According to a school district spokeswoman, the student had been a student in the district, but it was unclear at which local school.
"How thankful I am that all of our students are safe; all of our staff members are safe," Richmond Community Schools Superintendent Todd Terrill said.
Indiana State Police say the tipster's call gave them valuable time to lock down the school.
"It is important to emphasise that due to the result of advance notification of the potential for a violent act at the school, the school had initiated lockdown procedure which clearly prevented injury to students and faculty even though the suspect was able to enter the school," the police statement added.
A woman who lives near the school told CBS that she spoke to the suspect's father, who said that "his son took all of his guns this morning" and forced him to drive him to the school.
A local ABC News affiliate reports that the tip came from the suspect's mother, but police have yet to confirm the identity of the caller.
Dennis will not be open for students Fri Dec 14 & Mon Dec 17. All other RCS schools will be open. The event today at Dennis was an isolated incident. We will have extra law enforcement presence at all schools. If you plan to keep your children home tomorrow, we understand. pic.twitter.com/e6bNUYNWvh— WeRrichmond (@wearrrichmond) December 13, 2018
Classes have been cancelled for Friday and Monday at the Dennis Intermediate School.
The foiled shooting occurred one day before the six-year anniversary of one of the worst school shootings in US history at Sandy Hook Elementary School in Connecticut.
That attack left dead 26 people - 20 under the age of seven - at the hands of a 20-year-old assault rifle-wielding gunman, who investigators have recently said had felt a "scorn for humanity".
On Friday - the day of the anniversary - classes were cancelled at Sandy Hook after the school received a bomb threat.