A federal judge has ruled that the school district and Broward County Sheriff's Office had no legal duty to protect students during the shooting earlier this year at Marjory Stoneman Douglas High School.

>> Read more trending news

U.S. District Judge Beth Bloom dismissed the lawsuit brought by 15 student survivors of the shooting against six defendants, including the Broward School District, the Broward Sheriff's Office and school resource deputy Scot Peterson.

The plaintiffs argued that the Sheriff's Office, the school district and others failed to protect students against shooter Nikolas Cruz, despite many warnings about his behavior before the Feb. 14 shooting that left 17 dead. It specifically criticized deputy Scot Peterson, who was armed but failed to confront Cruz during the shooting.

"His arbitrary and conscience-shocking actions and inactions directly and predictably caused children to die, get injured, and get traumatized," the lawsuit said of Peterson, according to the Sun Sentinel.

But Bloom said in the ruling that students -- unlike mental patients and prison inmates -- are not in a custodial relationship with the state, reported WPLG-TV.

"Absent that type of restraint, there can be no concomitant duty to provide for the student's safety and general well-being," Bloom wrote.