Afghan President Hamid Karzai has strongly condemned the killing of a French United Nations worker in the south-eastern province of Ghazni.
He said those responsible were enemies of the Afghan people.
Bettina Goislard, 29, of refugee agency UNHCR, was shot dead in a bazaar by two unidentified men on a motorcycle.
Several Afghan humanitarian workers have been murdered in recent months, but it is the first such killing of a foreigner since March.
Mr Karzai issued a statement in which he expressed "shock" at the killing, calling it "an act of enmity by terrorists against the Afghan people".
UN Secretary-General Kofi Annan condemned the attack as "outrageous and contemptible".
The UN has ordered all its workers in Kandahar, Jalalabad and Gardez as well as Ghazni to remain in their compounds.
Local employees have also been told to go home.
UN spokesman David Singh said two men on a motorbike opened fire at a UNHCR vehicle fatally wounding Bettina Goislard and injuring the driver.
"At around 1230 (0830 GMT) today, two men on a motorcycle drove by a UNHCR vehicle in Ghazni bazaar. The passenger opened fire at point-blank range," Mr Singh said.
The Afghan driver was shot in the arm, but his wounds were not life-threatening, he added.
A presidential spokesperson told the BBC that the two men were beaten up by angry local people before they were arrested by Afghan police.
Police were trying to identify the men and to determine the motive for the attack, Ghazni's governor said.
Correspondents say similar attacks have been blamed on Taleban remnants who have
increasingly targeted aid workers in recent months.
This is the first time a UN worker has been killed since the Taleban regime was ousted by US-led forces in 2001, Mr Singh said.
There was no immediate claim of responsibility for Sunday's shooting.
On Tuesday, a car bomb exploded outside a United Nations office in Kandahar.
No one was killed or injured in that blast, which damaged windows and barriers around the building.