The school district and sheriff’s office in the Florida county that is home to Marjory Stoneman Douglas High School had no constitutional duty to protect the students there during the deadly February massacre, a federal judge has said in a ruling.

The decision was made in a lawsuit filed by 15 students who said they suffered trauma during the Feb. 14 attack in Parkland, Fla. A total of 17 students and staff members lost their lives; 17 others were injured.

Prosecutors are seeking the death penalty for Nikolas Cruz, 20, the former Stoneman Douglas student who is accused of opening fire at the school on Valentine’s Day. He has pleaded not guilty, but his lawyers have said he would plead guilty in exchange for a life sentence.

The Dec. 12 ruling, by Judge Beth Bloom, came on the same day that a county judge, Patti Englander Henning, came to the opposite conclusion. Judge Henning found that Scot Peterson, the armed sheriff’s deputy who heard the gunfire but did not run in and try to stop the attack, did have an obligation to confront Mr. Cruz.