"The political arrangement between the Afghan government and the Taliban did not go forward as envisaged," he wrote.
"The reasons for this are too complex and I will share my thoughts in the coming day and weeks."
Born in Afghanistan, the dapper 70-year-old academic turned US diplomat took senior positions as part of the inner circle of former president George W Bush, becoming the US ambassador to Kabul and then Baghdad and the United Nations.
As former president Donald Trump itched to end America's longest war in Afghanistan, he brought back Khalilzad, who led exhaustive talks with the Taliban -- without including the US-backed government in Kabul.
Those talks led to a February 2020 agreement in which US troops would leave the following year.
But peace negotiations between the Taliban and the leadership in Kabul failed to gain traction, and the government that the United States built over 20 years crumbled within days as US troops left.
Rare US figure
Steeped in Afghanistan's language and customs, Khalilzad was a rare US diplomat able to develop a cordial rapport with Taliban leaders whose regime was toppled by the United States after the 11 September, 2001 attacks over its welcome to Al-Qaeda.
Khalilzad, despite his Republican affiliation, was kept in place when Democratic president Joe Biden defeated Trump and decided to go ahead with the withdrawal.
Khalilzad soon became a lightning rod for criticism, with even his superiors in the Biden administration -- while voicing respect for him personally -- faulting the diplomacy behind the 2020 agreement.
Blinken said that Khalilzad's deputy, Thomas West, would take over as the special envoy.
West is a longtime aide to Biden, serving on his staff when he was vice president. West has worked for years on South Asia policy including on the US-India civilian nuclear deal.
Shortly before Khalilzad's resignation became public, the State Department said the United States would not be able to attend a new session called Tuesday by Russia that also includes China and Pakistan, historically the Taliban's primary backer.
'Time not on our side'
After Trump ended US opposition to speaking to the Taliban, Khalilzad engineered the release from a Pakistani jail of the group's co-founder Mullah Baradar, seen as a figure who could deliver on promises, and spent months with the largely rural rebels in a luxury hotel in the Qatari capital Doha.
But pictures of him smiling with the Taliban earned him heated criticism in Kabul where some in the now-fallen government as well as newly Western-oriented elite berated him and accused him of selling out Afghanistan.
In interviews last month, Khalilzad said that he had reached a deal with the Taliban in which the insurgents would stay out of Kabul and negotiate a political transition.
But Khalilzad said the deal collapsed when president Ashraf Ghani fled the country on 15 August and the Taliban saw a security vacuum.
Speaking to Foreign Policy, Khalilzad said that the Taliban fulfilled key parts of the February 2020 agreement including not attacking the departing US troops.
"I respect those who say we shouldn't have negotiated with the Talibs without the government being there. But we don't know how much more fighting would have taken for the Talibs to agree to that," he said.
But with no appetite in the United States for another surge of troops in its longest war, "each year we were losing ground to the Talibs," he said.
"Time was not on our side."
Husain Haqqani, a former Pakistani ambassador to Washington who is now a senior fellow at the Hudson Institute, said that Khalilzad failed in that he "equated US withdrawal with peace."
"Khalilzad handed the keys of Kabul to the Taliban in return for promises everyone knew the Taliban would not keep," Haqqani said.