The United Nations (search) envoy to Afghanistan (search) has stepped down as promised following approval of a new constitution hailed as a chance to cement a fragile peace two years after the ouster of the Taliban (search) regime.

Lakhdar Brahimi was appointed to the two-year post in late 2001 and had planned to leave once Afghanistan's constitutional grand council had finished its work, U.N. spokesman Fred Eckhard said Monday.

The veteran Algerian diplomat oversaw U.N. operations in Afghanistan through the U.S. war to oust the Taliban and during efforts to rebuild the war-ravaged country.

He recently warned that the United Nations would have to withdraw its staff if security doesn't improve, and he demanded that international peacekeepers steered by NATO play a larger role in the country.

On Monday, gunmen attacked the office of the United Nations refugee agency in Kandahar, throwing a grenade and firing shots but causing no injuries.

The United Nations pulled its foreign staff out of vast areas of Afghanistan in October after a refugee worker was killed. That followed a similar pullback from Iraq after an August truck bomb killed 23 people at the U.N. headquarters in Baghdad.

NATO now plans to expand patrols beyond Kabul.

Brahimi was expected to leave Afghanistan in a few days. Jean Arnault, his deputy for political affairs, will fill the post until a permanent replacement is found.