Private security companies will have to end operations in Afghanistan in four months, President Hamid Karzai has ordered.
He issued the ultimatum to the companies in a decree signed in Kabul.
The decision is expected to be met with resistance from Nato forces who use private contractors as guards for convoys and on bases.
Mr Karzai also condemned the stoning to death on Sunday of a couple accused of adultery by the Taliban.
He said that he had ordered security officials to bring the perpetrators of the unforgivable punishment - in the northern province of Kunduz - to justice.
"Stoning these two young Afghans by an illegal group without a fair trial is an inhuman and un-Islamic act that can in no way be justified," the president said in a statement.
Human rights group Amnesty International said it was the first confirmed stoning in Afghanistan since the fall of the Taliban government nine years ago.
The stoning was watched by about 1,000 people at a bazaar in the village of Mullah Quli, which is under Taliban control.
Mr Karzai pledged to limit the operations of security companies when he was sworn in as president last year.
Private contractors will have to either disband or join the Afghan police, according to the order read out by Mr Karzai on Tuesday.
Contractors working for international embassies and non-governmental organisations will be exempt from the decree, as long as security personnel stay within their compounds, the order says.
"After some thorough and legal review I am approving the annulment of foreign and national security companies within four months," Mr Karzai said.
There have been "tragic incidents" where the actions of private contractors had led to the deaths of innocent Afghan civilians, he said.
There are 52 companies, both international and domestic, registered with the government.
There are many more unregistered companies roaming Afghanistan without uniforms or supervision, says the BBC's Quentin Somerville in Kabul.
Government police and army forces are unable to operate in large sections of the country without international forces backing them up, our correspondent adds.
State Department spokesman PJ Crowley said US officials want clarification and more details about the order.
"At this moment, we believe there is still a need for private security companies to continue to operate in Afghanistan - four months is a very challenging deadline," Mr Crowley said.