A Pennsylvania middle school canceled classes Wednesday after a sleepwalking student prompted a security scare.

Pennsylvania State Police told KDKA-TV that officers received a report of a break-in around 2:30 a.m. at the Wendover Middle School in Greensburg, located east of Pittsburgh.

“It appears he went through a screen in the window and got himself in the school. He was in the school about 15 minutes,” Pennsylvania State Trooper Stephan told KDKA. “He believes he was sleepwalking and went to the school.”

State police said the student lived about four miles from the school.

The Hempfield Area School District said in a statement on its website it canceled classes Wednesday as a precautionary measure, and police swept the building for any potential issues. There were "no signs of vandalism or theft" as a result of the incident.

OHIO STUDENT DIES AFTER SHOOTING HIMSELF IN SCHOOL BATHROOM, OFFICIALS SAY

The district said the sleepwalking student incident is not connected to another student's arrest earlier this week for allegedly threatening to shoot a female student.

“A couple days prior, we did have a male student verbally threaten a female student, saying he was going to shoot her,” Limani told KDKA.

The student accused of making the threat has been arrested and is being held in the Westmoreland County Juvenile Detention Center, authorities said.

"In light of the recent events, an added police presence will be at Wendover Middle School tomorrow and counselors will be available to talk with students regarding school violence and safety, as needed," the school district posted on its website. "Additionally, the PA State Police have indicated that they are striving to have an added presence at all district schools."

Classes were scheduled to resume at the middle school Thursday.