A knife attack at a middle school in China left seven children dead and 12 others injured on Friday, according to officials.

Local authorities believe a former student was behind the evening stabbing spree, which happened in Shaanxi province’s Mizhi county — just as kids were being let out for the day, CCTV reports.

The suspect, who is an adult, was later apprehended without incident.

He reportedly told cops that he had been “bullied” at the school when he was younger, causing him to “hate” his classmates. The 28-year-old chose to take his anger out on the current students — killing five girls and two boys, whose ages were unknown.

Nine girls and three boys were wounded, officials said.

The suspect, identified by the surname Zhao, reportedly confessed and was being held Friday night local time. His alleged rampage is just the latest in a long line of knife attacks in China, with the most recent one happening in February.

According to the South China Morning Post, a man with “a personal grudge” went after numerous people with a blade as they shopped at a mall in Beijing. One woman was killed and 12 others were injured.

In January 2017, a man barged into a kindergarten classroom in China’s southern Guangxi Zhuang region with a kitchen knife and stabbed 11 children. The students all survived.

Another man wounded 10 children in the southern island province of Hainan in February 2016 — and then took his own life.

With Post wires