Updated

A man armed with a knife stabbed two people Friday outside a rural Alaska school, state troopers said.

Kotlik School Principal Cory Stringer locked down the school before 19-year-old Rick Andrews could reach the front door, authorities said.

Investigators said Andrews was “upset about something” when he was on his way to the school and then he pounded on the door, threatened to kill Stringer and tried to get inside through the windows and another door, KTVA-TV reported.

“The principal of the school saw Andrews walking toward the entryway with a large knife in his hand,” troopers wrote in a dispatch. “The principal initiated a school lockdown just before Andrews made it to the front door. Andrews began hitting the door trying to gain entry and then made verbal threats to the principal wanting to kill him and stab him.”

A man and a woman approached Andrews and attempted to intervene when Andrews stabbed both of them in the torso, authorities said. The victims were in stable condition, according to KTUU-TV.

One person was able to get the knife away from Andrews, while police said two other residents restrained him until troopers arrived.

Andrews was charged with two counts of second-degree assault and one count of third-degree assault, according to KTUU-TV.

Troopers said a knife was recovered and that they don’t believe alcohol played a factor in the stabbing.

The Associated Press contributed to this report.