Afghanistan's spy chief resigned over policy disagreements with President Ashraf Ghani, according to a copy of the resignation letter sent to the media on Thursday.
The head of the National Directorate of Security (NDS), Rahmatullah Nabil, said that "unfortunately a lack of agreement on policy matters and restrictions imposed" on him by the president had created an atmosphere where he could not do his job.
In his letter, Nabil alleged that Ghani had "verbally" asked him to resign.
Nabil's resignation comes amid a string of high-profile Taliban attacks around the country, including Tuesday's deadly assault on the airport in southern Kandahar city.
It also comes a day after Ghani agreed, during a trip to neighboring Pakistan in meetings with Pakistani, U.S. and Chinese officials, to resume peace negotiations with the Taliban to bring in end to the violence in Afghanistan.
Nabil was believed to be opposed to engaging the militants in talks through Pakistan's mediation.
Sources in Pakistan said the Pakistani military and spy agency were also unhappy working with the NDS under Nabil to promote peace in Afghanistan. Some reports had suggested that Islamabad was seeking his resignation.
Pakistani Prime Minister Nawaz Sharif, center right, greets Afghan President Ashraf Ghani, center left, upon his arrival at Nur Khan airbase in Rawalpindi, Pakistan, Dec. 9, 2015.
Ghani visited Pakistan to attend the Heart of Asia process ministerial conference of Afghanistan's near and far neighbors to discuss security and economic cooperation in the war-torn country.
Pakistani officials told VOA that U.S., Chinese and Afghan leaders agreed to resume the reconciliation talks with Taliban as early as next week during the discussions Wednesday.
Deputy Secretary of State Antony Blinken represented the United States in the crucial meetings in Islamabad and on Thursday he met with Pakistani military chief General Raheel Sharif to further the discussions.
"During the meeting both the dignitaries discussed matters related to security challenges and reiterated the need of early resumption of reconciliation process to achieve lasting peace in Afghanistan, which is so critical for stability in the region," the Pakistan military said in a statement issued after the meeting.
On Wednesday, Nabil, in a Facebook posting, criticized what he termed as pro-Pakistan remarks by Ghani at the conference. He said it amounted to surrendering "Afghanistan's 5,000 year history to Pakistan's 60-year history."