BEIJING (Reuters) - An assailant killed seven Chinese middle school students who were on their way home from classes on Friday, and the suspected attacker has been caught, state news agency Xinhua reported.

The attack happened in Mizhi county in the northwestern province of Shaanxi, Xinhua said in a brief report.

Twelve students were injured, it added.

The suspect has been taken into custody, Xinhua said, without providing any other details.

The Shaanxi City Express newspaper showed pictures on its microblog of children on the ground covered in blood, and the suspect being lead away by police.

Violent crime is rare in China compared with many other countries, especially in major cities where security is tight, but there has been a series of knife and axe attacks in recent years, many targeting children.

In February, a woman was killed and 12 people injured when a man carried out a knife attack in a mall in a busy shopping district in the capital, Beijing.

Such attacks are often blamed on people with mental illness or who have personal grievances. Knives are most commonly used because gun controls are extremely strict in China.