Maria Ortiz consoled her fifth-grade daughter, Crystal Godinez, outside Castle View Elementary School in Riverside, Calif. Officials said all students were accounted for as a man continued to hold a hostage inside the school. (Watchara Phomicinda/Riverside Press-Enterprise via AP)

This story has been updated.

A SWAT team swept into a Southern California elementary school Tuesday evening to rescue a teacher who had been held hostage by a father for hours, fatally shooting the man who had held her captive, police said.

Police in Riverside, Calif., said the man forced his way into Castle View Elementary about 11:20 a.m., hitting in the face a man who attempted to stop him. He then forced his way into the school, barricading himself inside a classroom with teacher Linda Montgomery, Officer Ryan Railsback, a spokesman for the Riverside Police Department, said during an evening news conference.

Castle View Incident: Update from the Riverside Police Departm...

Castle View Incident: Update from the Riverside Police Department and Comments from RUSD Live

Posted by Riverside Police Department on Tuesday, October 31, 2017

Staff members immediately called police and began ushering children and other teachers from the school. SWAT officers arrived at the school to assist with the evacuation. Meanwhile, smoke was seen seeping from the classroom, but it quickly dissipated. It was unclear whether the man was armed, Railsback said.

Railsback said the man, whom he declined to identify, refused repeated calls from officials to come out of the classroom. SWAT officers positioned themselves in an armored vehicle outside, and agents with the Bureau of Alcohol, Tobacco, Firearms and Explosives were on scene.

Eventually, after hours of communication with the man — and after hearing nothing from the teacher — officers made the decision to force their way into the classroom.

“The negotiators hadn’t had any contact or heard anything from the victim herself,” Railsback said. “We of course have been fearing for the hostage’s life all day.”

The Riverside Press-Enterprise reported that two flash-bangs were heard about 5:45 p.m., more than six hours after the teacher had been pulled into the classroom. At least one officer opened fire on the suspect. The suspect was taken to the hospital, where he was declared dead, Railsback said late Tuesday. He did not release his name or say exactly when the man had died.

Montgomery, the teacher, was also taken to a hospital for evaluation, but had no obvious injuries.

“I just can’t imagine what’s she’s gone through,” Railsback said. “I’m sure she’s going to suffer some emotional trauma.”

School officials have canceled classes at Castle View Elementary for the remainder of the week while officials continue to investigate and will offer counseling for affected students at Taft Elementary.

Riverside schools had already tightened security measures after a shooting at an elementary school about 20 miles north of Castle View in San Bernardino, Calif., left a student and a teacher dead. Now, Riverside Superintendent David Hansen said the school system will once again reevaluate its safety protocols.

“This tragedy is still a situation — is something we never want to go through again,” Hansen said. “It is something that we will learn from.”