HARTFORD, Conn. (AP) " A Connecticut judge has cited government immunity in dismissing a lawsuit by the parents of two children killed in the 2012 Newtown, Connecticut, school massacre against the town and its school district over alleged inadequate security measures.

Superior Court Judge Robin Wilson, in a decision released Tuesday, granted the town's request to dismiss the lawsuit, agreeing school officials were immune from being sued and the security procedures in place were discretionary.

"Emergencies, by their very nature, are sudden and often rapidly evolving events, and a response can never be one hundred percent scripted and directed," Wilson wrote.

"To say that the faculty and staff of the school were to act in a prescribed manner in responding to an emergency situation would likewise be illogical and in direct contradiction to the very purpose of governmental immunity: allowing for the exercise of judgment without fear of second-guessing," she wrote.

The shooting killed 20 first-graders and six educators at Sandy Hook Elementary School on Dec. 14, 2012. Gunman Adam Lanza, 20, fatally shot his mother at their Newtown home before going to the school, where he killed himself as police arrived. Lanza shot his way through a locked glass entryway to get into the building.

The parents of two first-graders killed in the shooting, Jesse Lewis and Noah Pozner, sued the town on several claims, including that school officials didn't follow security procedures including immediately ordering a school lockdown after Lanza shot his way in, which they say may have saved lives. They also said the school's classroom doors could only be locked from the outside in the hallway, making it impossible for teachers to safely lock them as Lanza approached their classrooms.

Their lawyer, Donald Papcsy, said he was reviewing the ruling and had no immediate comment Tuesday. He said an appeal is likely.

The lawsuit also alleged that school officials failed to provide keys to either teacher Victoria Soto or substitute teacher Lauren Rousseau so they could follow school lockdown procedures, if ordered, and lock their doors.

Fifteen students and Rousseau were killed in Room 8, and five students and Soto were slain in Room 10.

Charles DeLuca, a lawyer for the town, said Lanza's intentional criminal acts were the sole cause of the shooting.

"We don't believe that there was any evidence that the town or its employees or the Board of Education was negligent or at fault in any way for this tragedy that occurred," DeLuca said Tuesday.