Nikolas Cruz’s psychosis ended in a bloody massacre not only because of the stunning incompetence of the Broward County Sheriff’s Department.

Nikolas Cruz’s psychosis ended in a bloody massacre not only because of the stunning incompetence of the Broward County Sheriff’s Department. It was also the result of liberal insanity working exactly as it was intended to.

School and law enforcement officials knew Cruz was a ticking time bomb. They did nothing because of a deliberate, willful, bragged-about policy to end the “school-to-prison pipeline.” This is the feature part of the story, not the bug part.

If Cruz had taken out full-page ads in the local newspapers, he could not have demonstrated more clearly that he was a dangerous psychotic. He assaulted students, cursed out teachers, kicked in classroom doors, started fist fights, threw chairs, threatened to kill other students, mutilated small animals, pulled a rifle on his mother, drank gasoline and cut himself, among other “red flags.”

Over and over again, students at Marjory Stoneman Douglas High School reported Cruz’s terrifying behavior to school administrators, including Kelvin Greenleaf, “security specialist,” and Peter Mahmood, head of JROTC.

At least three students showed school administrators Cruz’s near-constant messages threatening to kill them — e.g., “I am going to enjoy seeing you down on the grass,” “Im going to watch ypu bleed,” “iam going to shoot you dead�?� �?? including one that came with a photo of Cruz�??s guns. They warned school authorities that he was bringing weapons to school. They filed written reports.

Threatening to kill someone is a felony. In addition to locking Cruz away for a while, having a felony record would have prevented him from purchasing a gun.

All the school had to do was risk Cruz not going to college, and depriving Yale University of a Latino class member, by reporting a few of his felonies — and there would have been no mass shooting.

But Cruz was never arrested. He wasn’t referred to law enforcement. He wasn’t even expelled.

Instead, Cruz was just moved around from school to school — six transfers in three years. But he was always sent back to Marjory Stoneman Douglas High School, in order to mainstream him, so that he could get a good job someday!

The moronic idea behind the “school-to-prison pipeline” is that the only reason so many “black and brown bodies” are in prison is because they were disciplined in high school, diminishing their opportunities. End the discipline and … problem solved!

It’s like “The Wizard of Oz” in reverse. The Wizard told the Scarecrow: You don’t need an education, you just need a diploma! The school-to-prison pipeline idiocy tells students: You don’t need to behave in high school, you just need to leave with no criminal record!

Of course, killjoys will say that removing the consequences of bad behavior only encourages more bad behavior. But that’s not the view of Learned Professionals, who took summer courses at Michigan State Ed School.

In a stroke of genius, they realized that the only problem criminals have is that people keep lists of their criminal activities. It’s the list that prevents them from getting into M.I.T. and designing space stations on Mars. Where they will cure cancer.

This primitive, stone-age thinking was made official Broward County policy in a Nov. 5, 2013, agreement titled “Collaborative Agreement on School Discipline.”

The first “whereas” clause of the agreement states that “the use of arrests and referrals to the criminal justice system may decrease a student’s chance of graduation, entering higher education, joining the military and getting a job.”

Get it? It’s the arrest — not the behavior that led to the arrest — that reduces a student’s chance at a successful life. (For example, just look at how much the district’s refusal to arrest Nikolas Cruz helped him!

The agreement’s third “whereas�?� clause specifically cites “students of color” as victims of the old, racist policy of treating criminal behavior criminally.

Say, in the middle of a drive to cut back on the arrest or expulsion of “students of color,” how do you suppose the school dealt with a kid named “Nikolas Cruz”? Might there be some connection between his Hispanic last name and the school’s abject refusal to do anything about Cruz’s repeated criminal behavior?

Just a few months ago, the superintendent of Broward County Public Schools, Robert W. Runcie, was actually bragging about how student arrests had plummeted under his bold leadership.

When he took over in 2011, the district had “the highest number of school-related arrests in the state.” But today, he boasted, Broward has “one of the lowest rates of arrest in the state.” By the simple expedient of ignoring criminal behavior, student arrests had declined by a whopping 78 percent.

FOOTBALL COACH: “When I took over this team a year ago, we were last in the league in pass defense. Today, we no longer keep that statistic!”

When it comes to spectacular crimes, it’s usually hard to say how it could have been prevented. But in this case, we have a paper trail. In the pursuit of a demented ideology, specific people agreed not to report, arrest or prosecute dangerous students like Nikolas Cruz.

These were the parties to the Nov. 5, 2013, agreement that ensured Cruz would be out on the street with full access to firearms:

Robert W. Runcie, Superintendent of Schools

Peter M. Weinstein, Chief Judge of the 17th Judicial Circuit

Michael J. Satz, State Attorney

Howard Finkelstein, Public Defender

Scott Israel, Broward County Sheriff

Franklin Adderley, Chief of the Fort Lauderdale Police Department

Wansley Walters, Secretary of the Florida Department of Juvenile Justice

Marsha Ellison, President of the Fort Lauderdale Branch of the NAACP and Chair of the Juvenile Justice Advisory Board

Nikolas Cruz may be crazy, but the parties to that agreement are crazy, too. They decided to make high school students their guinea pigs for an experiment based on a noxious ideology. The blood of 17 people is on their hands.