Amid applause and embraces, Afghan leaders signed a pact Wednesday to create a temporary administration for their war-ravaged nation. It will be headed by a moderate Muslim and will include two women.

The choosing of an interim government to lead Afghanistan for the next six months was the result of nine days of furious negotiating and enormous international pressure on the four Afghan factions meeting at a secluded luxury hotel near Bonn.

Under the pact, anti-Taliban commander Hamid Karzai and his Cabinet will take over power in Afghanistan from the triumphant northern alliance on Dec. 22. The move also secures billions in promised aid to reconstruct the country.

German leaders and U.N. envoy Lakhdar Brahimi, who shepherded the parties and won the deal, broke into applause at the signing ceremony Wednesday morning. Brahimi then embraced the delegates and German Chancellor Gerhard Schroeder and Foreign Minister Joschka Fischer shook hands with the chief envoys who had just signed.

"It's miraculous, it really is, from what we had 10 days ago," a Western diplomat observing the talks said. "It gets the process going, which really is the point. We have a long way to go, but you have to start somewhere."

The agreement establishes a 30-member interim Cabinet, which is meant as the first step toward a broad-based government representing the range of Afghanistan's ethnic groups and regions.

Karzai, who served in a post-Soviet government that was toppled by the Taliban, was acceptable to most delegates because he is a member of Afghanistan's largest ethnic group, the Pashtuns.

He was represented at the talks by the northern alliance faction, though he did not participate in the fighting that swept the Taliban from northern Afghanistan. His fighters are part of the current push to oust the Taliban from their last stronghold, in Kandahar.

In addition to the alliance, negotiating at the talks were envoys of the former Afghan king and two smaller groups representing Afghan exiles in Cyprus and Peshawar, Pakistan.

After intense haggling over posts, the northern alliance retained the powerful defense, foreign and interior ministries under the accord. Two women also were named to posts — Sima Samar as a deputy premier and minister of women's affairs and Suhaila Seddiqi as health minister.

The final stretch of negotiating took 10 hours, in order to come to an agreement on the composition of an interim authority that will govern Afghanistan for six months until the former king convenes a traditional tribal council, or loya jirga.

With ethnic balance as the primary criterion, Brahimi shuttled among the four factions through the night Tuesday to cull 30 names from 150 candidates.

The final Cabinet list was not being released, however, until 10 or 11 candidates can be contacted to formally accept the posts, U.N. spokesman Ahmad Fawzi said. The replies were expected later Wednesday.

Footage from the elegant Petersberg hotel, where the delegations have been meeting under tight security, showed Brahimi and the four delegation leaders emerging from a conference room, weary but smiling.

The four factions had sought to achieve a balance in the interim government that represented Afghanistan's main Pashtun, Tajik, Uzbek and Hazara ethnic groups — and also women, who have been virtually excluded from public life under the Taliban.

Karzai is one of the most prominent commanders fighting near Kandahar, and leads a force of some 4,000 men. He also speaks fluent English.

Distinguished not only by his battlefield valor, Karzai is head of the influential Popalzoi clan, which has been linked to the Afghan royal dynasty that existed from the mid-18th century until King Mohammad Zaher Shah was deposed in 1973.

He was deputy foreign minister in a government that emerged in 1992 after the withdrawal of the Soviet administration, but left his post in 1994 because he was disillusioned by relentless bickering among the groups. The Taliban seized power in 1996.

Karzai came under attack from Taliban forces when he returned from exile in mid-October to help persuade Afghans to support a new government under the chairmanship of the deposed king. The United States claims to have extracted Karzai from Afghanistan after he asked for help, but Karzai has denied this.

Brahimi was preparing to travel to Afghanistan this weekend to begin preparations for the transfer of power from Rabbani, the northern alliance leader, Fawzi said.

Rabbani is still recognized as Afghan president by the United Nations and portrayed by Western diplomats as reluctant to step aside for a younger generation of leaders.

Under the U.N. plan, the interim administration will govern until a loya jirga can convene to ratify a transitional government, paving the way for elections within two years.

Also envisioned are the deployment of an international security force to Kabul and other parts of the country, steps to integrate Afghan fighters into a future national army, and the creation of a supreme court.

The final text, obtained by The Associated Press, includes language saying the Afghan people have the right "to determine their own political future in accordance with the principles of Islam, democracy, pluralism and social justice."

The final text also expresses appreciation to Afghan fighters for defending the nation's independence and to Rabbani for "his readiness to transfer power."