The week-long ceasefire, which would bring some welcome relief to war-weary civilians, will last "from the 27th of Ramadan until the fifth day of Eid-al-Fitr", President Ashraf Ghani tweeted from an official account, indicating it could run from June 12-19.
It was not immediately clear if the Taliban would agree to the ceasefire, the first during Eid since the US invasion in 2001.
"We are checking with our officials regarding the ceasefire announcement," Taliban spokesman Zabihullah Mujahid told AFP.
The surprise declaration comes on the heels of a fatwa issued by Afghanistan's top clerics branding suicide attacks "haram", or forbidden, and after the Pentagon announced that senior Taliban officials had been negotiating with Afghan authorities on a possible ceasefire.
Nearly 17 years after they were toppled from power, the Taliban are resurgent, with Afghan forces -- who have taken the lead in the conflict since NATO combat troops pulled out in 2014 -- struggling to contain them, while civilians pay a disproportionate price in the fighting.
"(T)he Afghan government directs all the security and defence forces of the country... to stop all the attacks on the Taliban, but the operation will continue against Daesh (Islamic State), Al-Qaeda and other international terrorist networks," Ghani said in an official statement.
Ghani added that more details about the ceasefire will be revealed during a "massive gathering" next week but did not elaborate further.
Deputy interior affairs minister General Akhtar Mohammad Ebrahimi said that if security forces are attacked during the ceasefire period, "your security and defence forces will respond".
General Mohammad Sharif Yaftali, the army chief of staff, added that if the ceasefire holds it "could be extended".
Last month, the Pentagon said that ceasefire negotiations with the Taliban were ongoing.
However analysts were sceptical of any positive response, saying Ghani's announcement appeared to be unilateral.
Kabul-based political analyst Haroon Mir said the Taliban were "highly unlikely" to agree to a ceasefire.
Calling it "symbolic", he said Ghani was "probably trying to strengthen his political position and present himself as a more serious peacemaker".
"I doubt this announcement will change anything on the ground," he added.
Rahimullah Yusufzai, a Taliban expert based in the Pakistani city of Peshawar, agreed.
"A ceasefire normally is negotiated... This is one-sided and I don't expect the Taliban to respond positively," he told AFP.
An hour after the fatwa was issued on June 4, a suicide bomber detonated outside the gathering, killing seven people.
The attack was claimed by the Islamic State group, and was the latest demonstration of militants' ability to hit the capital, which has become the deadliest place in the country for civilians.
It also showed that any ceasefire with the Taliban alone might have a limited effect on security, given the myriad other militant groups infesting Afghanistan.
The Taliban view Ghani's government as illegitimate, and have previously said they would negotiate only with the US, whom they consider the main players in the conflict.
In February Ghani unveiled a plan to open peace talks with the Taliban, including eventually recognising them as a political party. At the time he suggested a ceasefire would form part of the plan.
The insurgents did not officially respond, but attacks have proliferated since then, especially in Kabul.
However when coupled with the fatwa, the announcement does put pressure on the Taliban, Yusufzai said.
"If it was only Ghani or the government, then the Taliban wouldn't have cared or even answered," he said.
"This is the clerics who are telling the Taliban only the state can announce jihad... The Taliban cannot just say they don't agree, they will have to come up with an answer."
Afghanistan's High Peace Council, charged with negotiating with the Taliban, backed Ghani's announcement Thursday.
Social media users desperate for peace quickly called on the insurgents to agree to the ceasefire, though many were sceptical.
"It's not a ceasefire if only one side observes it," said Twitter user Said Kamal Hassan.
Others were more hopeful.
"I hope all parties involved announce ceasefire and not a single bullet is fired anymore," wrote Twitter user Sharyar Hadi. "We are tired of wars and killings."
Get the latest election news, live updates and election schedule for Lok Sabha Elections 2019 on ndtv.com/elections. Like us on Facebook or follow us on Twitter and Instagram for updates from each of the 543 parliamentary seats for the 2019 Indian general elections. Election results will be out on May 23.