KABUL - Afghanistan is moving closer to a peace deal with notorious warlord Gulbuddin Hekmatyar, sources said Wednesday, possibly paving the way for his political return after years in hiding despite a history of rights abuses.

Hekmatyar, who heads the now largely dormant Hezb-i-Islami militant group, is the latest among a series of warlords whom Kabul has sought to reintegrate into Afghan politics in the post-Taliban era.

If inked, the deal with Afghanistan's second-biggest militant group would mark a symbolic victory for President Ashraf Ghani, who has struggled to revive peace talks with the much more powerful Taliban.

"Both sides are very close to signing the peace deal," a senior member of Hekmatyar's negotiating team told AFP.

"Both parties have reached an agreement on most points of the peace plan. I am hopeful they will reach a consensus on the remaining points very soon."

According to the 25-point draft agreement seen by AFP, the government will offer Hekmatyar legal immunity in "all past political and military proceedings".

The draft also says Hekmatyar, in his 60s, "can select two or three suitable places for residence in Afghanistan and the government is obliged to provide necessary security and costs for this purpose".

Hekmatyar was a prominent anti-Soviet commander in the 1980s and stands accused of killing thousands of people during the 1992-1996 civil war.

The warlord is designated a "global terrorist" by the US and is blacklisted by the UN. The Afghan government would be obliged to work towards lifting those restrictions, according to the draft agreement.

"The High Peace Council (responsible for reconciliation efforts with militants) has sent the draft deal to President Ghani," said presidential spokesman Shah Hussain Murtazawi.

"The president is studying the draft," he added, without specifying when it is likely to be signed.

The potential deal has sparked revulsion from human rights groups.

"We want peace with militant groups but not at the cost of our people's rights," Seema Samar, head of the Afghanistan Independent Human Rights Commission, told AFP.

"We are against this blatant impunity culture."

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.