The Taliban on Saturday announced a surprise three-day ceasefire with the Afghan government for the duration of Eid al-Fitr, the religious holiday that marks the end of Ramadan. The halt in hostilities at the end of this week comes two days after the Afghan president, Ashraf Ghani, announced his government’s unilateral eight-day ceasefire.

It is the first time in nearly 17 years that the militants have declared a cessation of violence, albeit a limited one, since the government it ran was toppled by the 2001 US-led invasion.

“All Mujahideen are instructed to stop their offensive operations against domestic opposition,” the Taliban announced. However, it insisted that attacks on foreign forces should continue. “Foreign occupiers are excepted; continue your offensives on them whenever and wherever you see them,” leaders told their followers in a statement.

President Ghani had ordered security forces to cease operations against the Taliban last week but stressed that the fight against the Islamic State, al-Qaida and other groups in the country would continue. Ghani’s decision came after a meeting of Islamic clerics declared a fatwa, or ruling, against suicide bombings, one of which, claimed by Islamic State, killed 14 people at the entrance to the clerics’ peace tent in Kabul. The clerics also recommended a ceasefire with the Taliban, which Ghani endorsed.

US forces said they would honour the Afghan government ceasefire. “We will adhere to the wishes of Afghanistan to enjoy a peaceful end to the Islamic holy month of Ramadan, and support the search for an end to the conflict,” said Gen John Nicholson, commander of international forces in Afghanistan.

Nick Kay, the UK ambassador to Afghanistan, described the ceasefire announcement as an important statement in pursuit of the peace. “Let us hope peace prevails,” he said.

The UN secretary-general’s special representative for Afghanistan, Tadamichi Yamamoto, said he hoped the ceasefires would “serve as a stepping stone” towards peace talks between the Afghan government and the Taliban.

At least 50 Afghan soldiers and police were killed in clashes across the country – 17 soldiers died in the Zawal district of western Herat province, nine border police were killed in the Bala Murghab district of north-western Badghis province, and at least 20 Afghan police were killed in the Qala e Zal district of northern Kunduz province on Friday. All the deaths were claimed by the Taliban.

US President Donald Trump unveiled a more hawkish military approach to Afghanistan in August last year, including a surge in air strikes aimed at forcing the Taliban to the negotiating table.

Reuters contributed to this report