By Josh Smith and Mirwais Harooni

KABUL (Reuters) - Afghan officials initialed a peace deal on Thursday with a party led by one of the country's most notorious Islamist warlords, a move that inspired both hope and fear as it dredged up tension dating back decades.

The militant faction of Hezb-i-Islami, led by Gulbuddin Hekmatyar, has been waging a decades-long battle to establish a unified Islamic state in Afghanistan.

Government officials praised the accord as a step towards peace, while critics said it opened the door to one of the most infamous figures in Afghanistan playing a role in the country's already divisive politics.

"I hope that this is the beginning of a permanent peace in our country," said Sayed Ahmad Gilani, head of the government's High Peace Council and one of the signatories of the agreement.

It was not immediately clear when it would be implemented.

Hekmatyar is a controversial figure, having been accused of killing or wounding thousands of people when his troops fired on civilian areas of Kabul during the civil wars of the 1990s.

Compared to other militant groups like the Taliban or Islamic State, however, Hezb-i-Islami has played a relatively small role in the insurgency recently and analysts say the accord is mostly symbolic.

"The deal will have little impact on the dynamics of conflict," said Timor Sharan, a Kabul-based analyst for the International Crisis Group. "The government's rationale is that by luring Hekmatyar on board, other insurgent groups might be encouraged to consider peace too."

During the 1980s, Hekmatyar received significant aid from the United States, Pakistan, and Saudi Arabia to fight Soviet forces occupying Afghanistan.

After the U.S.-led campaign that toppled the Taliban regime in 2001, Hekmatyar, having split from his international backers, narrowly survived an American drone strike. Later he was designated a "global terrorist" by the United States for his suspected ties to al Qaeda and the Taliban.

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 anti-government elements".

The agreement will grant Hekmatyar amnesty for past offences and the release of certain Hezb-i-Islami prisoners. The Kabul government also agreed to press for the lifting of international sanctions on Hekmatyar.

Several hundred protesters gathered in Kabul, carrying signs calling the deal a "crime".

"Any deal with Hekmatyar and other criminals is treason," said Sealy Ghaffar, a protest organizer. "Peace will never be achieved by sacrificing justice."

Welcoming Hekmatyar poses challenges for an Afghan regime already split between President Ashraf Ghani and Chief Executive Abdullah Abdullah, who are each surrounded by other warlords and power brokers, many with histories of ethnic divisions.

Abdullah's mainly Tajik supporters have been alarmed by the prospect of a powerful Pashtun bloc upsetting the uneasy equilibrium that has held since the disputed 2014 election was resolved with the creation of a national unity government.

"(Hekmatyar's) arrival is likely to intensify tensions within an already fragile state by opening up historical grievances among different factions and strongmen," Sharan said. "The key question is whether some of these rival leaders are ready to give up a piece of a pie to their arch enemy."

Other former warlords, notably Vice President Rashid Dostum and second Chief Executive Mohammad Mohaqiq, have also faced accusations of rights abuses and have still been included in the government.

Hekmatyar's return "will compound the culture of impunity", said Human Rights Watch researcher Patricia Gossman, who called it an "affront" to victims of abuses.

Peace talks with the Taliban, the largest insurgent group, have yet to get off the ground, but both sides have said they are open to the idea.

(Writing by Josh Smith; Editing by Nick Macfie)