One of the two Uygur men sentenced to death by a court in Xinjiang had founded a "terrorist" group just a month before his arrest, state media reported.
The two defendants were, along with three other ethnic minority Uygurs, found guilty by the Kashgar court of crimes related to terrorism and intentional homicide, stemming from a deadly outbreak of violence in April that killed 21 people in Bachu county.
The three spared the death penalty received sentences ranging from nine years to life in prison for participating in the terrorist group, and for their part in the April confrontation between police and residents.
Among those killed were 15 community workers and police officers, as well as six "terrorists".
Musa Hesen was sentenced to death for murder, organising and leading a terrorist group, and illegally manufacturing explosives, according to the verdict. Rehman Hupur was also sentenced to death for murder and participating in the terrorist group.
Xinhua reported that the group was set up on March 8, by Qasim Muhammat and Hesen, with Muhammat as its leader.
According to a court statement, the five defendants and Muhammat, who was killed in the attack, carried out illegal religious activities, promoted religious extremism and regularly watched video clips advocating terrorism since March 2008.
They also "made knives and banners in preparation for terrorist attacks" and created 10 explosive devices and carried out explosive tests, the statement said. All of the defendants confessed to their crimes in court, Xinhua reported.
The Global Times, a newspaper affiliated with the People's Daily, also quoted experts to support the sentence.
"Upholding laws during our fight against terrorism helps people at home and abroad get a clearer understanding about terrorist threats in Xinjiang," the newspaper quoted Li Wei , an anti-terrorism expert at the China Institutes of Contemporary International Relations, as saying.
Turgunjan Tursun, a research fellow at the Xinjiang Academy of Social Sciences, asserted that the violence was unrelated to ethnic, religious or political issues, according to the paper.
"No matter what banner or slogan [the groups use], violent attacks are against the law," Tursun told the paper. "We must punish the crime in accordance with the law, and the sentence was a demonstration of that."
The violence on April 23 was among a series of incidents highlighting ongoing tensions between authorities and members of the region's native Turkic-speaking Uygurs.
That month, community watch members came across a room being used by the defendants and their associates and reported their suspicions to police. Fearing exposure, the court said, the men used machetes and axes to attack the community workers and police officers.
Additional reporting by Associated Press, Agence France-Presse