The ceasefire which begins Sunday was first announced by the Taliban, then welcomed by Afghan President Ashraf Ghani.
The Taliban declared a three-day Eid ceasefire in Afghanistan starting Sunday, via a tweet on Saturday from the hardline group, and the country's president said the government would reciprocate.
The move came as fighting between the two sides had intensified despite the coronavirus pandemic.
"Do not carry out any offensive operations against the enemy anywhere, if any action is taken against you by the enemy, defend yourself," Zabihullah Mujahid, a Taliban spokesman, tweeted. He added that the ceasefire was declared solely for Eid festivities marking the end of the holy month of Ramadan.
Afghanistan's President Ashraf Ghani welcomed the Taliban's ceasefire announcement and extended the offer of peace. "As Commander-in-Chief I have instructed ANDSF (Afghan National Defense and Security Forces) to comply with the three-days truce and to defend only if attacked," he said in a tweet.
Ghani also vowed to speed up the release of Taliban prisoners.
"As a responsible government we take one more step forward – I announce that I will expedite the Taliban prisoner releases," he said in an address to the nation marking Eid al-Fitr holiday.
He also urged the militants to press on with the release of Afghan security personnel they hold.
US negotiator hails Afghan-Taliban ceasefire
US negotiator Zalmay Khalilzad on Saturday welcomed the surprise announcement of a three-day ceasefire between Afghan and Taliban forces during the Eid al Fitr holiday, hailing it as "a momentous opportunity that should not be missed."
"The US will do its part to help," the envoy, who brokered a withdrawal deal between the Taliban and US forces that was announced earlier this year, added in a tweet.
Last month, the Taliban rejected a government call for a ceasefire across Afghanistan for Ramadan, saying a truce was "not rational" as they ramped up attacks on Afghan forces.
At least 146 civilians were killed and 430 wounded by the Taliban during Ramadan, Javid Faisal, a spokesman for the country's main intelligence and security office in Kabul, said on Saturday.