A professor at Texas A&M University at Galveston just jumped ship—but not before failing an entire class for what he calls a pattern of cheating, backstabbing and all-around bad behavior.

That’s one way to teach students a lesson.

In a drama fit for an after-school special, Irwin B. Horwitz sent a withering email to the 30 students in his strategic management class to announce he was giving each student an “F,” before walking out and never coming back.

“Since teaching this course, I have caught and seen cheating, been told to ‘chill out,’ ‘get out of my space,’ ‘go back and teach,’ [been] called a ‘fucking moron’ to my face,” Horwitz wrote in the missive obtained last week by Inside Higher Ed.

The disgruntled egghead continued to unfurl a litany of offenses including: students cheated by signing in for classmates, didn’t show up when they claimed they did, and spread “hurtful and untrue rumors about myself and others” online.

“None of you ... given the behavior in this class, deserve to pass,” Horwitz, 53, wrote in the dispatch.

“I am frankly and completely disgusted,” he added. “You all lack the honor and maturity to live up to the standards that Texas A&M holds, and the competence and/or desire to do the quality work necessary to pass the course.”

Horwitz, who only joined the university last year, didn’t stop there. He also sent an email to school administrators, telling them the unruly pupils are “your problem now.”

It’s unclear how an entire class brought him to the brink, but Horwitz summed it up for a local TV station: “Enough was enough.”

“Yesterday I reached the breaking point,” Horwitz told Houston’s KPRC. “It became apparent that they couldn’t do some of the most simple and basic things they should have been able to do.”

Horwitz, who has 20 years of teaching experience, said the raucous behavior was so severe that he requested police protection during lectures at the Department of Maritime Administration, according to KPRC.

“I was dealing with cheating, dealing with individuals swearing at me both in and out of class—it got to the point that the school had to put security guards at that class and another class,” he said.

The professor claimed his complaints fell on deaf ears.

Before he quit, Horwitz told university higher-ups that only “a few” learners were respectful and performing academically. His request to teach only these good apples was denied. That’s when Horwitz made the decision to fail the whole class and vamoose, Inside Higher Ed reported.

Still, university officials say Horwitz’s epic fail won’t fly.

“None of them have failed until the end of the class, meaning the only reason a student would fail is because he or she has not performed the expectations for that particular class,” Patrick Louchouarn, vice president for academic affairs, told KPRC.

Students disagreed with the collective grade.

“Just ridiculous—I had never had a problem in the class,” John Shaw, a senior, told KPRC. “I thought I had done pretty well, done pretty well on the first test and then I get an email saying I am going to get an F in the class, it was overwhelming.”

Another student, Rutger Dukes, commented on various news sites, including Inside Higher Ed, writing, “I am in his class. I do not deserve to fail because one person in our class was rude. We were given papers to write along with a group presentation. He said we would be given rubric for everything … we were ever given one.”

“He has flipped out on us before for no reason,” he added.

Dukes said the student who was allegedly cheating and “making a big scene” was given the boot, and “as soon as we were all getting along, he sends that email to us.”

But at least one former student gave Horwitz accolades in 2010, when he was a lecturer at University of St. Thomas in Houston. In a collection of thank-you notes to professors, the student thanked Horwitz for being “so concerned for my well-being.”

“I had a rough patch with my health last semester and he was willing to work with me and help me out,” the student wrote. “We developed a great student/teacher relationship and see him as a friend/mentor. He may have a rep for being a crazy hard teacher, but he is fair and his work load was just the same as any other class I have ever taken anywhere else.”