Workers arrested at South Africa's Marikana mine have been charged in court with the murder of 34 of their colleagues shot by police.

The 270 workers would be tried under the "common purpose" doctrine because they were in the crowd which confronted police on 16 August, an official said.

Police opened fire, killing 34 miners and sparking a national outcry.

Police have not been charged because a commission of inquiry would investigate their actions, the official said.

It was the most deadly police action since South Africa became a democracy in 1994.

Six of the 270 workers remain in hospital, after being wounded in the shooting at the mine owned by Lonmin, the world's third biggest platinum producer, in South Africa's North West province.

The other 264 workers appeared in the Ga Rankuwa magistrates court near the capital, Pretoria.

Their application for bail was rejected and the case was adjourned for seven days.

About 100 people protested outside the court, demanding the immediate release of the men.

The decision by the South African authorities to charge 270 workers with the murder of 34 of their colleagues who were shot dead by police is politically controversial.

The prosecution is relying on the "common purpose" doctrine, once used by the former white minority regime against black activists fighting for democracy.

At the time, the African National Congress (ANC), the former liberation movement now in power, campaigned against the doctrine.

Now, its critics will accuse it of behaving just like the apartheid regime and turning victims into perpetrators.

The government has already been strongly criticised over the shooting, which has been dubbed the "Marikana massacre" and compared to the atrocities committed by the apartheid-era police.

The National Prosecuting Authority is officially an independent body but most South Africans believe it has close links to the ANC and this decision is likely to lead to more condemnation of President Jacob Zuma's government.

National Prosecuting Authority (NPA) spokesman Frank Lesenyego told the BBC the 270 workers would all face murder charges - including those who were unarmed or were at the back of the crowd.

"This is under common law, where people are charged with common purpose in a situation where there are suspects with guns or any weapons and they confront or attack the police and a shooting takes place and there are fatalities," he said.

BBC South Africa analyst Farouk Chothia say the decision to bring murder charges under the "common purpose" doctrine is politically controversial because the former white minority regime used it against activists fighting for democracy in South Africa.

The protests were triggered by demands for a huge pay rise and recognition of a new union.

Talks are continuing to resolve the dispute, which has shut the mine for the past three weeks.

During a visit to the mine after the killings, President Jacob Zuma told workers he "felt their pain" and promised that a commission of inquiry would investigate the killings.

Mr Lesenyego said the commission would rule on the conduct of the police.

"It's a separate case," he said.

The commission and an internal police review are expected to take several months to complete.

Police said they started shooting after being threatened by large groups of miners armed with machetes.

Ten people, including two police officers and two security guards, were killed during the protests before the police shooting.