KABUL, Afghanistan — Since his days as a C.I.A.-backed Afghan guerrilla leader against the Soviets in the 1980s, the former prime minister and perpetual insurgent Gulbuddin Hekmatyar has always seemed to be negotiating his next shift of alliances.

Now, with his Hezb-i-Islami militant group nearly eclipsed by the Taliban, Mr. Hekmatyar, 68, is once again working a deal — this time to formally reconcile with the Afghan government for the first time since the end of the country’s civil war.

After years of failed overtures, representatives of Mr. Hekmatyar, whose location is unknown, are now said to be finalizing a peace agreement with the struggling government of President Ashraf Ghani, according to representatives from both sides. If signed, the agreement would allow Mr. Hekmatyar to return to Kabul for the first time since 1996. That was when the Taliban pushed him out of power after he had negotiated a deal to become prime minister in return for ending his insurgency against the government.

For Mr. Hekmatyar, history seems to repeat like that.

But the timing of the efforts to make peace with Mr. Hekmatyar’s small faction of the insurgency this time has raised questions in Kabul. Mr. Ghani’s government, failing to persuade the Taliban to come to the table this winter, is hoping that a quick deal with Mr. Hekmatyar, which evaded the previous administration, would bring it much-needed good news. The government’s peace body, the High Peace Council, also needs to show some results for the hundreds of millions of dollars in donor money it has spent on the reconciliation process.