Hekmatyar, who heads the now largely dormant Hezb-i-Islami militant group, is the latest in a series of controversial figures that Kabul has sought to reintegrate in the post-Taliban era.
The deal with Afghanistan’s second-biggest militant group marks a symbolic victory for President Ashraf Ghani, who has struggled to revive peace talks with the more powerful Taliban.
A Hezb-i-Islami delegation shook hands with members of the High Peace Council (HPC), responsible for reconciliation efforts with militants, and the national security adviser at an official ceremony in Kabul.
“This agreement is signed after two years of negotiations between the High Peace Council, the leadership of the Afghan Government and the Hizb-e-Islami,” deputy HPC chief Habiba Sorabi said at the ceremony.
“The peace negotiations… have been successfully completed.”
The agreement will come into force when it is formally signed by President Ashraf Ghani and Hekmatyar, the government has said, though no date has been set.
Hekmatyar, derided widely as the “butcher of Kabul”, was a prominent anti-Soviet commander in the 1980s who stands accused of killing thousands of people in the Afghan capital during the 1992-1996 civil war. Neither he nor Ghani were present at the signing.
He is widely believed to be living in hiding in Pakistan, but his group claims he remains in Afghanistan.
The deal paves the way for him to make a comeback in mainstream politics in a pattern well established by other warlords, such as General Abdul Rashid Dostum, currently the country’s first vice president.
But it has sparked revulsion from human rights groups.
“His return will 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,” Human Rights Watch said last month.
According to an initial draft agreement, the government will offer Hekmatyar legal immunity in “all past political and military proceedings” as well as release Hezb-i-Islami prisoners.
Hekmatyar is designated a “global terrorist” by the US and is blacklisted by the UN. The Afghan government will likely work towards lifting those restrictions in order to reintegrate him into local politics.
The deal is not likely to have an immediate impact on the security situation in Afghanistan.
Hezb-i-Islami has been largely inactive in recent years, with its last big attack in Afghanistan in 2013. That killed 15 people including five Americans.
The US State Department had earlier said Washington was not involved in the talks but welcomed the potential truce with Hekmatyar.
The Taliban, who were toppled from power in 2001, have refused to engage in talks with the Western-backed Afghan government as they ramp up their nationwide offensive against it.