Twenty-one people, including police officers and social workers, have been killed in violent clashes in China's ethnically divided western region of Xinjiang in what the government is calling an act of terrorism.

Al Jazeera's Marga Ortigas said on Wednesday police were investigating an arson attack in the region where the violence began.

"The region has been the focal point for ethnic and racial tensions for quite some time now," Ortigas said.

A local official confirmed to the AFP news agency on Wednesday that the battle had taken place.

"Twenty-one persons were killed in all... including social workers and policemen," the official said.

He told the news agency that the violence broke out on Tuesday when three local officials reported a group of suspicious men armed with knives hiding inside a home in Selibuya township outside the city of Kashgar.

The death toll was the highest for a single incident in months in Xinjiang, which sees recurrent outbreaks of violence pitting Muslim minority Uyghurs against the authorities and majority ethnic Han Chinese migrants.

'Uyghur repression'

Tianshan Net, a government-run news website, described the fighting as a "violent terror incident".

It said 15 of those killed were either police or social workers, with 11 of them being members of China's Uyghur ethnic minority, who mainly live in Xinjiang.

Six "gang members" were shot dead in the violence, while eight more were captured, the report said.

The source who spoke to AFP confirmed the contents of the report, but said he did not know how many police were among the dead.

The incident points to the chaotic nature of much of the Xinjiang violence, as well as problems with how authorities respond.

Armed units are often stationed in larger towns and barracks and must be specially summoned by commanders before they can respond.

The Uyghurs have long alleged discrimination in China because of their culture, language and Muslim religion.

Last week, the US State Department released a report claiming "severe official repression of the freedoms of speech, religion, association, and harsh restrictions on the movement" of Uyghurs by the Chinese government.

Hua Chunying, a foreign ministry spokeswoman, said the case is still being investigated, but accused those involved for plotting "to carry out violent terrorist activities".

"China is a country ruled by the law," said Hua. "Cracking down on crimes and ensuring the safety of citizens and their property is what the constitution and the law of China entitles the public security authorities to do".