The head of Afghanistan's main intelligence agency, the National Directorate of Security, resigned on Thursday over disagreements with President Ashraf Ghani, laying bare divisions that have hindered efforts to fight the growing Taliban insurgency.
The resignation of Rahmatullah Nabil follows a series of setbacks in recent months including the fall of the northern city of Kunduz to the Taliban and a raid on Kandahar airport in the south on Tuesday in which 50 civilians, police and security personnel were killed.
Relations between Ghani and the NDS have been strained since at least the fall of Kunduz, which an inquiry last month blamed on poor leadership.
Later, Ghani dismissed some NDS officials including the provincial chief of the agency who he said had neglected their duty to defend Kunduz.
In the letter, Nabil said that over the past few months, there had been "a lack of agreement on some policy matters" and the president had imposed unacceptable conditions on his ability to do his job.
He said Ghani's "repeated verbal summons" had put him under impossible pressure and forced his resignation.
Ghani later issued a statement saying he had not wanted Nabil to resign because of the difficult security situation but he respected the decision.
The resignation raises fresh questions over the leadership of Afghanistan's security apparatus, which has struggled to contain a Taliban insurgency that has gained momentum since international forces ended most combat operations last year.
Already without a permanent defence minister, due to disagreements between partners in Ghani's national unity government, the country now has no spy chief just as the raid in Kandahar underlined the Taliban's ability to inflict serious damage on government forces.
Afghan security forces stand guard at the entrance gate of Kandahar Airport where Taliban stormed on late Tuesday, in Kandahar, Afghanistan December 9, 2015. Photo: Reuters/Stringer
The Taliban, which also seized the important district of Khanishin in Helmand province, said in a statement that the operation had succeeded in "humiliating" the government "by sending a message that the Mujahideen are able to reach the most secure enemy locations undetected."
The resignation, a day after Ghani attended the Heart of Asia peace conference in Islamabad, also clouds prospects for a coordinated effort to resume peace talks including both the Taliban and Pakistan that were broken off this year.
In an angrily worded post on Facebook that appeared before the resignation letter was made public, Nabil made clear his frustration with efforts to work with Pakistan, which many in Afghanistan accuse of controlling the Taliban.
He said the blood of innocent people spilled in recent attacks was "the same colour as the red carpet we trod like a catwalk".