A 49-year-old man has injured 20 children with a hammer inside a primary school in China's capital, Beijing, according to authorities.

The suspect, identified by his surname, Jia, was apprehended at the scene after the Tuesday morning incident at Beijing No 1 Affiliated Elementary School of Xuanwu Normal School, the Xicheng district government said on its social media account.

The statement said three of the children, who were all taken to hospital, had serious but non-life-threatening injuries.

Jia, a native of northern Heilongjiang province, was employed through a labour service company to perform daily maintenance work at the school.

His contract was set to expire this month and had not been renewed.

To express his dissatisfaction, Xicheng district said, Jia wielded a hammer that he normally used for work to injure students during a class at 11:17am local time (03:17 GMT).

The school, founded in 1908, has 2,537 students and 199 teaching personnel, according to its website.

Previous incidents

Violent attacks targeting schoolchildren are not uncommon in China, which has seen a number 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 attacker slashed students while they were returning to the classroom after morning exercises.

And in January 2017, a farmer armed with a kitchen knife stabbed and 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.

The school of Tuesday's incident, founded in 1908, has 2,537 students and 199 teaching personnel, according to its website.