Police chief Matiullah Qatay is said to have been killed in the gun battle
Forty-one US-trained Afghan guards have been arrested after a shootout in which Kandahar's provincial police chief was killed, the regional governor says.
Thoryalai Wesa says the guards will be sent from the southern province to the capital Kabul for trial.
Up to eight other policemen were killed after the guards, who are employed by US security forces, entered the prosecutor's office in Kandahar city.
They were trying to free colleagues held in the building, the BBC was told.
Afghan President Hamid Karzai said he "seriously condemns this action", describing it as a "serious blow to governance-building".
In a statement, Mr Karzai's office described what had happened.
"Armed men from one of the private security firms based in Kandahar tried to free two criminals - they attacked the local prosecutor's office," it said.
"The police chief of Kandahar and the head of the criminal investigation department resisted them - these guards opened fire" and killed them, it went on.
The statement said three others were also killed, although other reports put the total at nine.
The police chief has been named as Matiullah Qatay and the head of the criminal investigation department as Abdul Khaliq Hamdam.
The US military spokesman in Kabul, Col Greg Julian, confirmed to the AFP news agency that there had been "an incident" but did not have details.
Some witnesses had said US forces were at the scene of the incident, but this is unconfirmed.
A spokesman for Nato-led forces in Afghanistan said they were looking into the incident.
The BBC's Martin Patience in Kabul says that Afghan guards are often employed at coalition military bases across the country.
They are paid and trained by the US. While the guards are recognised by the Afghan government, they do not come under their command.
Locals often refer to these guards as Afghan special forces as they are well-trained and well-armed, our correspondent says.
Kandahar is the spiritual birthplace of the Taliban - although the Taliban are not believed to be involved in this latest incident.
The province has seen an increase in violence in recent years and shootings are common, the BBC's Martin Patience in Kabul says.
It is a key battleground in the fight between the Taliban insurgency and the Afghan government and coalition forces.