KABUL, Afghanistan — The Taliban’s announcement Saturday of a temporary cease-fire did more than offer hope in war-weary Afghanistan for a quiet Eid al-Fitr, one of the most important holidays in the Islamic year.

It also added momentum to efforts to launch a peace process that could end nearly 17 years of fighting.

Two days after Afghan President Ashraf Ghani declared an eight-day pause in hostilities against the Taliban beginning Tuesday — at the end of the fasting month of Ramadan — the insurgent group made a reciprocal pledge to cease fighting government forces for three of those days.

The decision was made “in order to make Eid days and nights happy for the people of Afghanistan,” the group said in a statement.

The Taliban said that the cease-fire later this month would not apply to U.S.-led NATO forces and that it would continue to defend itself against attacks. The group continued offensive operations in the hours before the announcement, with Afghan defense officials saying Saturday that Taliban attacks had killed 40 members of the security forces in northern and western Afghanistan in the preceding 24 hours.

The Taliban’s first cease-fire pledge seemed to present an opening for talks to prolong the break in hostilities.

“That the Taliban chose their ‘unilateral’ cease-fire to coincide with the Afghan government’s announcement is a cautious step toward public cooperation with the government on peace,” said Ahmad Shuja, an Afghan analyst and editor-in-chief of the Georgetown Public Policy Review.

Many Afghans believe the government’s cease-fire pledge came at the urging of the United States, which is searching for a way out of the war after sending thousands more troops last year to bolster Afghan forces.

On Thursday, a senior State Department official who briefed reporters on condition of anonymity said the U.S. and its allies were “focused on … trying to find the right formula that enables us to reduce (military) operations, and that comes from a political settlement.”

The Taliban have long denied participating in official peace efforts and declined to comment on Ghani’s most recent offer, extended in February, to grant amnesty for militants who renounced violence and recognized the government’s authority.

The insurgent group’s leadership, which is based in neighboring Pakistan, has publicly accused the government of not being serious about peace and of being a stooge of U.S.-led foreign forces.

Yet even as the Taliban have wrested more territory from the grip of the government — 35 percent of Afghans live in areas controlled or contested by insurgents, according to a recent report by the Pentagon inspector general — the growing toll of their attacks on civilians has weakened their lofty claims of aiming to liberate Afghans from what they describe as U.S. military occupation.

Supporters of the Islamic State militant group also have carried out attacks separate from the Taliban.

In recent months, a peaceful protest movement that sprang from Helmand province, the Taliban’s heartland, has been marching north and gathering support from Afghans of many provinces and ethnic communities in a call for talks between the government and insurgents.

Dubbed the Helmand Peace March, the strength of the protest caught the government and the Taliban off guard.

“The Helmand Peace March is the most significant grass-roots peace effort to emerge from Taliban-held areas, a desperate cry for peace in a region ravaged by conflict,” Shuja said.

Special correspondent Sultan Faizy reported from Kabul and staff writer Shashank Bengali from Port Louis, Mauritius.

shashank.bengali@latimes.com