Afghanistan on Monday scrapped plans to ban private security firms following Western diplomatic and military concerns over the move, instead ushering in new restrictions to limit their work.
All 52 remaining licensed companies will continue to provide security to US-led troops, the Pentagon, the UN mission, aid groups, embassies and Western media companies in Afghanistan.
But the government announced tight rules on the firms' operations after accusations that private security guards have been involved in the killing of civilians, laying bombs and acting as bandits on the country's insecure roads.
"Their future operations will continue in accordance with the law and regulations in place," interior ministry adviser Abdul Manan Farahi said.
In August, Afghan President Hamid Karzai ordered the dissolution of all private security firms by the end of the year, causing fears that the move could endanger vital aid projects and the transport of military supplies.
On Saturday, during a press conference held with Pakistan's prime minister, Karzai said companies were involved in "killing, murdering our people, blowing up bombs and insecuring our highways".
He has also said the firms run an "economic mafia" based around "corruption contracts" favoured by the international community. But he first drew back from a complete ban in October under intense pressure from his Western backers, extending the deadline for dissolution and allowing firms protecting embassies and military bases to continue their work.
Monday's announcement means that authorised firms can carry on working indefinitely, but under tighter rules.
The seven security companies contracted to secure NATO's supply convoys will now have to work alongside 50 Afghan police officers.
Private security contractors must move their headquarters out of Kabul's de facto diplomatic enclave towards the city outskirts, all guards must wear uniforms and they cannot carry weapons in residential areas when off duty.
They are not allowed to stop vehicles, search houses or block roads for security reasons, said Farahi.
There will also be a gradual transition of security for foreign development projects from private security firms to Afghan forces, he said.
The ministry said the 52 firms legally mandated to operate employ more than 26,500 people, of whom about 3,400 are foreigners.
Karzai has said the firms duplicate the work of the Afghan security forces and divert much-needed resources, while Afghans criticise the private guards as overbearing and abusive, particularly on the country's roads.
In May, a convoy of private security guards were accused of killing four civilians during their searches of houses in southern Kandahar province, according to the Afghanistan Rights Monitor (ARM).
Another person was killed and one more wounded in April when several guards allegedly opened fire on civilians in central Wardak province, the rights group said.
Following the collapse of the Taliban regime in the 2001 US-led invasion private security firms rushed to fill a vacuum created by a lack of adequately trained police and army forces.
In 2006, the Afghan authorities began registering, regulating and licensing the firms but there have been questions about the activities of some.
Security firms under criminal investigation could still be forced to close, and a list of banned companies will be announced on 17 December, Farahi said.
Another 57 firms that were already declared illegal are being closed, Farahi said, with the final three to be dissolved within one week.
Afghanistan, one of the world's poorest countries and gripped by a nine-year Taliban insurgency, relies on billions of dollars in Western aid to build basic infrastructure and create jobs to dissuade men from taking up arms.