In this photo provided by Cory Stringer is the entrance to the Kotlik School Monday, May 14, 2018, in Kotlik, Alaska. Alaska State Troopers say a man with a knife tried to enter a rural school and stabbed two people outside. Authorities say the principal at Kotlik School locked it down Friday, May 11, 2018, just before 19-year-old Rick Andrews reached the front door. (Cory Stringer/Lower Yukon School District via AP) (Associated Press)

ANCHORAGE, Alaska — Two people were stabbed and wounded outside a remote Alaska village school by a man armed with a knife and shouting threats who tried to break in to the building, officials said Monday.

Students and staff at the school had to wait more than 45 minutes for law enforcement officers last Friday as the event unfolded in the Yupik Eskimo village of Kotlik, a community of 640.

Two villagers attempted to intervene and the man with the knife stabbed both of them, Alaska State Troopers said in a statement.

When the knife fell from the man’s hand, one of the injured people grabbed the knife and threw it into a pond. Two other villagers then subdued former student Rick Andrews, 19, the statement said. He is charged with three counts of felony assault.

The incident underscores dangers in rural Alaska communities without a tax base to support local law enforcement. Kotlik has two unarmed village public safety officers.

Remote Alaska communities hit by crime have had to wait hours or days for troopers to arrive. The officers who responded to Kotlik flew in from a community about 33 miles (53 kilometers) away.

“We were lucky the weather was good so they could fly in,” Cory Stringer, the school’s principal, said in an interview. “We just had to wait it out.”

Kotlik lies on flat, marshy land along a tributary of the Yukon River about 5 miles (8 kilometers) from the Bering Sea. Homes and the school are connected by wooden walkways instead of streets. The area is rich in fish and waterfowl and many in the Yupik Eskimo community practice a subsistence lifestyle.

The school teaches 172 students from kindergarten through high school and Stringer said he encouraged the suspect last fall to return to school to complete credits.

Andrews declined and created a disturbance about six weeks ago during a meeting at the school, but Stringer said he talked him into leaving.

On Thursday night, a teacher called Stringer to report a man damaging the school’s all-terrain vehicle. Stringer and a custodian responded and heard screaming behind the school. He said they found Andrews threatening to hit his 15-year-old girlfriend. The girl pulled away and Stringer said he stepped between the two teens.

“He was mad at me because I stopped whatever was going on that night,” Stringer said.

During high school lunch hour Friday, Stringer spoke to the mother of a student who left the school but returned to report that Andrews outside and threatening to kill the principal.

Andrews approached the front entrance with a knife in his hand and Stringer ordered the shutdown.

School staff locked outside doors and wedged a metal bar in the handles of double doors just inside the main entrance. They made sure all other doors were locked. Adults were stationed at each door. Stringer said training required by the school district kicked in.

“Everyone did their job and made sure the doors were secure,” Stringer said. “We just sat back and kind of watched the show through the door.”

Elementary students were not aware of the incident but the school’s high school students saw the events, Stringer said.

Andrews pounded on the door, threatened to kill the principal and tried to get inside through windows and another door, the police statement and Stringer said.

After at least a half hour, Andrews was out of sight along the side of the school. A man and a woman from the village approached him and attempted to intervene. Andrews stabbed both in the chest and stomach. When the knife fell, one of the wounded grabbed the knife and flung it into the pond.

Andrews fled but two other villagers held him until troopers arrived.

The wounded woman and man were treated at Kotlik Clinic and flown by air ambulance to a hospital. Troopers said they were in stable condition.

Andrews was jailed and is represented by the Alaska Public Defenders Agency.

Staff attorneys as a policy do not comment on pending cases and did not respond Monday to an email request for comment.

Copyright 2018 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.