Notorious Afghan warlord Gulbuddin Hekmatyar called for peace on September 29 as he appeared by video to sign an accord with President Ashraf Ghani.
The peace deal was signed at Kabul's presidential palace during a ceremony broadcast live on television.
Hekmatyar, the exiled leader of the Hezb-e Islami militant group, offered his congratulations to "all those Afghans who want peace and stability in the region" as he signed the agreement.
"I pray that our country be independent and sovereign, and our innocent and war-weary nation end the fighting and ongoing insecurity, and that unity prevails," he added.
"Now is the time for the Taliban to think about whether they want to continue the war or come for peace," Ghani said.
Under the agreement, Hekmatyar will be granted amnesty for past offenses and certain Hezb-e Islami prisoners will be released by the government. The Afghan government also agreed to press for the lifting of international sanctions on Hekmatyar. The deal also includes provisions for his security at government expense.
Negotiations with the group have been going on for months, with some in the government suspicious of bringing one of the most radical militants in Afghanistan into the fold.
Rights activists have expressed concerns about long-standing accusations of human rights abuses against Hekmatyar, who was responsible for some of the worst atrocities committed during the civil war in the 1990s.
Hezb-e Islami has also carried out deadly attacks against U.S. and Afghan forces since the U.S.-led invasion in 2001.
Kabul hopes a deal with Hezb-e Islami can convince the Taliban to end its insurgency and join the political process.
Based on reporting by AFP and AP