A three-day ceasefire agreed by the warring Taliban and Afghan government came into force on Thursday as the country celebrated Eid al-Fitr after weeks of deadly violence.

Proposed by the militants and matched by President Ashraf Ghani, the truce offered respite for Afghans as they mark the Muslim festival with friends and family.

Violence has intensified in the country since the United States missed a May 1 deadline, agreed with the Taliban last year, to withdraw all of its troops.

If the ceasefire holds, it will be only the fourth pause in fighting in nearly 20 years of conflict.

The three-day ceasefire will be only the fourth pause in fighting in nearly 20 years of conflict in Afghanistan
The three-day ceasefire will be only the fourth pause in fighting in nearly 20 years of conflict in Afghanistan AFP / WAKIL KOHSAR

Early on Thursday, Afghan men, women and children around the country flocked to mosques or gathered in open grounds to offer morning prayers at the start of Eid festivities that would last until Saturday.

Authorities deployed security personnel to prominent mosques in the capital Kabul who frisked worshippers as they arrived for morning prayers.

Crowds of Kabul residents later packed the capital's main zoo and parks as they celebrated the festival with families, with only a few wearing masks to protect from the coronavirus.

"I feel so relaxed and peaceful today because it is Eid and there is no fighting," said Mirajuddin, who like many Afghans goes by one name, who was visiting Kabul zoo with his five children, all dressed in new clothes.

Kabul resident Mohammad Sadeq said there was no more justification in fighting.

Map showing parts of Afghanistan currently under government control and territories under the influence of the Taliban, including Nerkh, seized by the insurgents on May 11, 2021
Map showing parts of Afghanistan currently under government control and territories under the influence of the Taliban, including Nerkh, seized by the insurgents on May 11, 2021 AFP / John SAEKI

"This is no more jihad as the Americans are leaving. Now it is brothers killing brothers because both the Taliban and security forces are Afghans," he said.

Amir Jan Sulaimankhil, a resident of the restive Nangarhar province that has seen several deadly attacks, said the Taliban and government should agree on a permanent ceasefire.

"That will make us happier, as many more lives will be saved," he said.

Muslims pray to start the Eid-al-Fitr festival at a mosque on the outskirts of Jalalabad
Muslims pray to start the Eid-al-Fitr festival at a mosque on the outskirts of Jalalabad AFP / NOORULLAH SHIRZADA

President Ghani used his annual Eid address to urge the Taliban to agree to a lasting truce now that international troops were leaving.

"We don't want you to surrender, but we want you to accept a political solution. War is not a solution," he said.

Tens of thousands of Afghans have been killed and millions have been displaced by the nearly two-decade-old conflict, which has seen a resurgent Taliban take hold of large swathes of the country.

The militants and the Afghan government launched peace talks in September last year, but progress has stalled despite international efforts to jump-start the negotiations.

Ceasefires in the past have largely held, in what is widely thought to be an exercise by the Taliban leadership to prove it has firm control over the myriad factions across the country that make up the hardline movement.

Afghan officials and Taliban said there were no immediate reports of any violation of the ceasefire.

Washington and NATO have pledged to withdraw their troops by September 11, leaving Afghan forces to defend themselves and protect the vulnerable population.

While the militants have avoided engaging American troops, they have stepped up attacks against Afghan government forces.

Violence has rocked several provinces in recent weeks, and on Tuesday the insurgents seized a district not far from the capital.

A series of blasts outside a girls' school in Kabul on Saturday killed more than 50 people, mostly teenage girls.

Families of victims were still in shock after the deaths of their loved ones.

"We were waiting for them to come home (from school," said Rahima, whose two daughters were killed in the school blasts.

"They had left the house together and later their bodies came together," she said as dozens of relatives offered condolences to her family on Thursday.

Officials blamed the Taliban, who denied they were involved in the attack in a neighbourhood largely populated by Shiite Hazaras who are often targeted by extremist Sunni Islamist militants.