The Afghan government has signed a draft peace accord with notorious exiled warlord Gulbuddin Hekmatyar, paving the way for his return after years of fighting the central authorities.

A government delegation and a team representing Hekmatyar's Hezb-e Islami militant group signed the document at a press conference in Kabul on September 22. The final agreement is expected to be signed by Hekmatyar and President Ashraf Ghani in the coming days. That is expected to be a mere formality.

"Fortunately, after two years of negotiations between Afghanistan's High Peace Council and the Hezb-e Islami, the peace negotiations have been successfully completed, and an agreement between both sides has been finalized," the Afghan High Peace Council, the presidentially appointed body tasked with pursuing a peace settlement with militant groups, said in a statement.

Sayed Ahmad Gilani, head of the High Peace Council, said at a news conference in Kabul that "in the light of our national interests, this could benefit both sides." He added, "I hope that this is the beginning of a permanent peace in our country."

Hekmatyar's forces were accused by rights groups of gross human rights violations during Afghanistan's civil war in the 1990s, and they have carried out deadly attacks against U.S. and Afghan forces since 2001.

Hundreds of protesters rallied in Kabul on September 22, holding placards reading "Butcher of Kabul" and "We will neither forget nor forgive."

A senior researcher on Afghanistan for the international group Human Rights Watch (HRW) has called the deal with Hekmatyar "an affront to victims of grave abuses."

"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," HRW's Patricia Gossman wrote as word spread of the pending deal.

HRW and other groups accuse Hekmatyar of responsibility for the shelling of residential areas of Kabul in the 1990s as well as forced disappearances and covert jails where torture was commonplace.

The U.S. Embassy in Kabul welcomed the accord as "a step in bringing the conflict in Afghanistan to a peaceful end." The United Nations said it "demonstrates the preparedness of Afghanistan's government to seek peace with armed antigovernment elements."

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.

The controversial peace deal is a breakthrough for Ghani, who so far has had little to show for his efforts at ending the country's 15-year war.

While the military wing of the Hezb-e Islami led by Hekmatyar has been a largely dormant force in recent years and has little political relevance in Afghanistan, the deal with the government could be a template for any future deal with fundamentalist Taliban militants who have also fought Kabul's authority.

Hezb-e Islami split up after the U.S.-led invasion in 2001, with the political wing reconciling with Kabul while Hekmatyar joined with the Taliban to lead the insurgency.

The Afghan government opened discussions with a delegation sent by Hekmatyar on March 17.

Hekmatyar is among the most radical of the hard-line militants in Afghanistan's recent past.

He founded Hezb-e Islami in the mid-1970s, and the group went on to become one of the main mujahedin factions fighting the Red Army after the Soviet invasion in 1979 before subsequently battling in the civil war for control of Kabul after Moscow pulled out.

Hekmatyar was seen as trying to rally Taliban troops against coalition forces, and his alleged attempts to ally with both that group and Al-Qaeda led the U.S. State Department to designate him a "global terrorist" in 2003.

Hekmatyar's precise whereabouts is unknown, but he is believed to be in neighboring Pakistan.