Afghanistan's government has signed a draft peace agreement with a designated "global terrorist" after lengthy negotiations that could pave the way for a similar accord with the Taliban.
The deal with warlord Gulbuddin Hekmatyar is Afghanistan's first peace agreement in the 15 years since the Taliban launched its insurgency, after it was driven from power following the 9/11 attacks on the US.
The deal, signed on live television, grants full political rights to his Hezb-i-Islami Gulbuddin party and obliges Afghan authorities to work to have it removed from the United Nations list of foreign terrorist organisations.
Hekmatyar was designated by the US as a "global terrorist" in 2003. He was blacklisted at Washington's request by the UN the same year. He is believed to live in Pakistan.
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 as it includes provisions for his security at government expense.
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 formalised, the agreement must be signed by president Ashraf Ghani and Gulbuddin Hekamtyar, although no timetable has been announced.
The deal marks a victory of sorts for Mr 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 Mr Ghani reverse course in recent months - he now openly accuses Pakistan of supporting and protecting the Taliban. Pakistan denies the accusations, although 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, Mr 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.