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 U.N. 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 Gulbuddin Hekamtyar; no timetable has been announced.

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 neighboring Pakistan. The failure of those efforts has seen Ghani reverse course in recent months — he now openly accuses Pakistan of supporting and protecting 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.

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.