Afghan President Ashraf Ghani announced a ceasefire with Taliban insurgents from Monday to mark the Muslim Eid al-Adha holiday, days after fighting in the central city of Ghazni and a northern province.
Taliban sources said their leaders had also provisionally agreed a four-day truce during the annual Islamic feast of sacrifice, though supreme leader Sheikh Haibatullah Akhunzada still had to give his final approval.
The militant movement said it would free hundreds of prisoners, without going into further details.
Fighting has been mounting in the Taliban's insurgency against the government in Kabul and NATO coalition forces, launched after the Islamist group was ousted from power in a U.S.-led military intervention in 2001.
The truce announcement came a day after clashes erupted in the northern province of Faryab, an interior ministry official said. The Taliban had taken control of part of Bulcheragh district and more than 50 government forces were missing, he added.
This month at least 150 soldiers and 95 civilians were killed in a five-day battle for control of Ghazni. Afghan soldiers backed by U.S. forces managed to push back the heavily armed rebels last week.
Earlier on Sunday, the United Nations said blasts, suicide attacks and clashes killed more than 1,600 civilians in the first six months of the year, the highest number in the past decade.
"The conditional ceasefire will start tomorrow and it will continue as long as the Taliban preserves and respects it," Ghani said in a ceremony celebrating 99 years of independence from British rule.
"We call on the leadership of the Taliban to welcome the wishes of Afghans for a long-lasting and real peace," he added.
A senior official in Ghani's office said the conditional ceasefire would run for three months, until the Prophet Mohammed's birthday which Afghanistan celebrate on Nov.21
It would only cover the Taliban, not other groups including Islamic State, officials said.
Since the withdrawal of most foreign combat troops in 2014, the Taliban has made slow but steady gains, now controlling or contesting more than 40 percent of Afghanistan.
In June this year, Ghani announced an unconditional ceasefire with the Taliban for about two weeks. The Taliban observed a ceasefire over the three-day Eid al-Fitr festival but rejected the government’s request to extend it.
Jens Stoltenberg, the secretary general of NATO, welcomed President Ghani's announcement. "I encourage the Taliban to demonstrate their concern for Afghans by respecting it," he tweeted.