A hammer-wielding man wounded 20 children in an attack at an elementary school in Beijing Tuesday with three suffering serious injuries, local authorities said.
A male suspect was brought "under control" and the wounded pupils were admitted to hospital, the Xicheng district government said.
Surnamed Jia, the 49-year-old assailant, was a contractor hired by the school for daily maintenance work.
His contract was scheduled to terminate at the end of January, stated the district government on its official Twitter-like Weibo account in a post that has since been deleted.
Though the school was discussing another job posting for Jia, he used a hammer and attacked students to "vent his resentment", they said.
Police have taken "compulsory measures" against the suspect.
Beijing police did not immediately respond to AFP's request for comment.
Violent attacks targeting schoolchildren are not uncommon in China, which has seen a slew of deadly incidents over the past few years, usually involving knives.
In April last year, a 28-year-old man killed nine middle-school students as they were returning home in one of the country's deadliest knife attacks in recent years.
The killer, who said he had been bullied when he attended the school in northern China's Shaanxi province, was executed in September.
Later in 2018, a knife-wielding woman injured 14 children at a kindergarten in Sichuan province.
The 39-year-old assailant slashed students while they were returning to the classroom after morning exercises.
In January 2017, a farmer armed with a kitchen knife wounded 12 children at a kindergarten in southern Guangxi Zhuang autonomous region. He was executed on Friday.
Such incidents have forced authorities to increase security around schools and led to calls for more research into the root causes of such acts.
'Death and destroy'
Violent crime has been on the rise in China as the nation's economy has boomed in recent decades and the gap between rich and poor has widened rapidly.
Studies have also described a rise in the prevalence of mental disorders, some of them linked to stress as the pace of life becomes faster and support systems wither.
In November, a driver rammed his car into a group of children crossing a street in front of an elementary school in northeastern Liaoning province, killing five people and injuring at least 19.
The man had been contemplating suicide "due to quarrels" with his spouse before the tragedy occurred, according to a report by official news agency Xinhua.
Earlier that month, at least 13 people died when a bus plunged off a bridge in Chongqing municipality, after the driver got into a fist fight with a passenger who had missed her bus stop.
In June 2017, a bomb blast that killed eight people and injured dozens outside a kindergarten in Fengxian, eastern China, was blamed on a 22-year-old introvert with health problems who had written the words "death" and "destroy" on the walls of his apartment.