Afghan President Ashraf Ghani has signed a peace treaty with a notorious warlord, pledging to lobby the US and the United Nations to remove him and his party from terrorist blacklists.

Gulbuddin Hekmatyar signed the agreement via a video-link into Kabul's presidential palace. Thursday's ceremony was broadcast live on television.

It is the first peace treaty the Afghan government has completed since the war with the Taliban began in 2001.

It has been welcomed by the international community as a possible template for any future peace deal with the Taliban, who have been fighting to overthrow the Kabul government for 15 years.

Once international sanctions are lifted, Hekmatyar is expected to return to Afghanistan after 20 years in exile. He is believed to be in Pakistan.

The head of his delegation in Kabul, Amin Karim, told the Associated Press on Wednesday that he believes the sanctions could be lifted within weeks.

Hekmatyar's party, Hezb-i-Islami Gulbuddin, is listed by the United Nations as a foreign terrorist organisation. Hekmatyar himself was designated by the US as a "global terrorist" in 2003.

He is widely disliked and distrusted by ordinary Afghans for his past extremism, including his support for al Qaida, and for carrying out sustained rocket attacks on Kabul during the 1990s civil war which are believed to have killed thousands of people.

Human Rights Watch, the New York-based watchdog, last week branded Hekmatyar "one of Afghanistan's most notorious war crimes suspects" and said his return would "compound a culture of impunity" that has denied justice to the many victims of warlords' forces.

The 25-point peace agreement gives Hekmatyar and his followers immunity for past actions, and grants them full political rights.

In a speech greeted by chants of "Long live Hekmatyar" from his supporters, who had gathered in the presidential palace, he called on the Afghan government to start peace talks with the Taliban.

Mr Ghani, who has said the deal with Hezb-i-Islami should be an example to the Taliban, said "now is the time for the Taliban to decide whether they want to continue the war, or participate in peace talks".