Sheriff’s Deputy Scot Peterson’s jaw-dropping decision not to enter Marjory Douglas Stoneman HS to face accused shooter Nikolas Cruz, and the three other Broward County cops’ reported similar refusal, was the culmination of an utterly mind-numbing series of failures by government systems.

And not even Peterson’s first failing: When neighbors warned they feared Cruz “planned to shoot up the school,” the Sheriff’s Office passed the reports to him; yet it seems he failed to follow up . And in September he refused to answer questions of deputies and social workers about Cruz’s troubles.

But it goes much further: The Broward and Palm Beach Sheriff’s offices got at least 18 calls about young Nikolas over the past decade, many involving guns, threats and violence. Officers visited his home in response to calls 39 times over seven years.

After four troubling incidents, the state Department of Children and Families opened a September 2016 investigation that noted Cruz’s interest in buying a gun but concluded he was a low risk for harm.

And the FBI admits it got a Jan. 5 tip-line warning about “Cruz’s gun ownership, desire to kill people, erratic behavior and disturbing social-media posts, as well as the potential of him conducting a school shooting” — but failed to share the info with its Miami field office. Agents did visit the Mississippi blogger who reported Cruz’s “I’m going to be a professional school shooter” comment on a YouTube video — but dropped it when the blogger said he knew nothing about the commenter.

Meanwhile, his high schools disciplined Cruz at least 25 times over the last three years; Stoneman even sent him to an alternative school.

And his unsettling actions began in middle school, with threatening statements, disturbing pictures and classmates bumped in the halls. It got so bad that some teachers even went so far as to ban Cruz from their classrooms. “Looking in his eyes, he just looked like there was a problem,” one teacher told The Washington Post.

(Ironically, Broward County won Team Obama praise for its schools’ embrace of “restorative justice” policies that offer counseling and other social services in lieu of reporting bullying, assault, drug abuse and so on to the police.)

Many students raised alarms: Cruz’s friend Ariana Lopez told ABC she repeatedly warned school officials of his behavior, such as selling knives at school. On social media, “he posted pictures of like 15 or more firearms just on his bed like this was normal, like you could even see a hamper in the background,” she said, adding that he talked of killing their friends and parents.

We absolutely stand by our calls for improved gun control, but the time is also beyond ripe to look at the mental-health and social-services systems, and at how schools and police handle troubled kids. So much writing was on the wall . . .