Afghanistan is close to signing a peace agreement with Gulbuddin Hekmatyar, President Ashraf Ghani said Monday, in a landmark accord that could pave the way for the notorious warlord's political return after years in hiding.

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 Ghani, who has struggled to revive peace talks with the much more powerful Taliban.

"The peace agreement will be finalized very soon," Ghani said in his address on the occasion of the Islamic festival of Eid-ul-Adha.

"We hope for peace in Afghanistan and to end the war in the country."

Ghani's statement comes after months of negotiations with Hizb-i-Islami, which has progressed in fits and starts over differences within the government over the final draft agreement.

On Sunday, Hekmatyar's son said on Facebook the agreement had been reached but the High Peace Council, the government body responsible for negotiations, said talks were still underway.

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

He is widely believed to be living in hiding in Pakistan, but his group claims he is inside Afghanistan.

The potential deal, which is unlikely to have an immediate impact on the security situation in Afghanistan, has sparked revulsion from human rights groups.

According to a draft agreement seen by AFP, 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 would work towards lifting those restrictions, according to the draft agreement.