KABUL -- Afghanistan's government signed a draft peace deal on Thursday with a designated "global terrorist" after lengthy negotiations that could pave the way for a similar accord with the Taliban, who have been waging war on Kabul for 15 years.
The deal with warlord Gulbuddin Hekmatyar is the country's first peace agreement since the Taliban launched their insurgency in 2001, after being driven from power in the wake of the 9-11 attacks on the United States.
It grants full political rights to his Hezb-i-Islami Gulbuddin party and obliges the Afghan authorities to work to have it removed from the United Nations' list of foreign terrorist organizations.
Hekmatyar himself was designated by the U.S. as a "global terrorist" in 2003. He was blacklisted at Washington's request by the UN the same year, and has similar status with the British government.
The agreement ends years of talks between Kabul and Hekmatyar, who is in his late 60s. It should enable him to return to Afghanistan after 20 years in exile -- he is believed to live in Pakistan -- as it includes provisions for his security at government expense.
The signing ceremony was broadcast live on television. The agreement was signed by the head of Kabul's High Peace Council, Ahmad Gilani, national security adviser Mohammad Hanif Atmar, and Hekmatyar's representative Amin Karim. Hekmatyar's son Habiburahman sat with an audience of officials.
To be formalized, the agreement must be signed by President Ashraf Ghani and Hekamtyar; Atmar said it would happen "as soon as possible."
The deal marks a victory of sorts for Ghani, who has been unable to bring peace to Afghanistan despite election promises and early efforts to forge a close diplomatic relationship with neighbouring Pakistan. The failure of those efforts has seen Ghani reverse course in recent months -- he now openly accuses Pakistan of supporting the Taliban. Pakistan denies the accusations, though the Taliban's leadership councils are based in Quetta and other Pakistani cities.
Talks between Kabul and the Taliban, hosted by Pakistan and aimed at ending the war, broke down earlier this year. Officials and diplomats have expressed hopes they can be revived, possibly as early as October.
With this peace deal, Ghani can demonstrate to the Taliban's leaders that his government is willing to make compromises for the sake of peace. The key points are the removal from international blacklists, immunity from prosecution for alleged war crimes, allowing unilateral political activity, and the release of prisoners.
"It proves peace is possible," Franz-Michael Mellbin, the European Union's special representative for Afghanistan, said of the agreement.
"The political space to say no to peace in Afghanistan is now virtually nonexistent," he told The Associated Press, adding that the deal "creates a new narrative that has been missing for many, many years."
The final deal is believed to be little changed from a draft agreed by Hekmatyar's representatives and the HPC in May, and seen by the AP. Finalizing the deal was held up by three demands from Hekmatyar that do not appear in the final draft, a senior official said. He spoke off the record as he was not authorized to comment publicly on the issue.
The contentious points were a demand that Afghanistan's insecurity be blamed "first and last" on the presence of foreign forces, a timetable for their withdrawal, and that he be granted a formal title as a saviour of the country, he said.
The deal enjoys the support of the international community, which has a vital role to play in bringing peace to Afghanistan due to the blacklists that also feature senior Taliban figures. The American, British and EU embassies, and the UN's mission in Kabul welcomed the deal as a step closer to peace. Ghani's office tweeted his hope that others would be encouraged to join the peace process.
Atmar called on Afghanistan's international partners to "end sanctions" against Hezb-i-Islami to ensure the success of the deal.
Hekmatyar's mujahideen fighters have been largely pushed to the sidelines of Afghanistan's war with many believed to have joined the Taliban. The last known attack carried out by his militants was in 2013, when at least 15 people, including six American soldiers, were killed in central Kabul.
He is best known, however, for causing the deaths of possibly thousands of people during the 1990s civil war, when his forces rained rockets on Kabul in his fight with other warlords for control of the capital.
Analyst Haroun Mir said that despite Hekmatyar's bloody past -- and his support for extreme groups such as al-Qaida -- the Afghan people will welcome the deal. "They are tired of conflict and they know that the ultimate solution for Afghanistan is political settlement, not only with Hezb-i-Islami but also with the Taliban," he said.
About 100 people demonstrated in central Kabul against the peace deal, holding posters showing Hekmatyar with blood dripping from his mouth and calling him the "Killer of Kabul."
New York-based Human Rights Watch issued a statement referring to Hekmatyar as "one of Afghanistan's most notorious war crimes suspects." Researcher Patricia Grossman said his return would "compound the culture of impunity that the Afghan government and its foreign donors have fostered by not pursuing accountability for the many victims of forces commanded by Hekmatyar and other warlords that laid waste to much of the country in the 1990s."
But some ordinary Afghans welcomed the agreement. "We are thirsty for peace and we welcome anyone who comes in peace, the past is the past," said shopkeeper Mohammad Hanif, 62.
Taliban spokesman Zabihullah Mujahid said it was too early to comment on the deal.
Mellbin, the EU's ambassador, said: "This is only the first step. Both sides will have to adapt to a very different political reality, this will not be easy and there may be setbacks. Successful implementation will be as crucial as the signing."
Associated Press writers Rahim Faiez, Amir Shah and Karim Sharifi in Kabul, Afghanistan, contributed to this report