Afghan President Ashraf Ghani prided himself on being one of the foremost global experts on failed states, only to watch his administration collapse.
He fled the country on Sunday, according to a top Afghan official, as the Taliban reached Kabul after an astonishing rout of government forces.
"The former president has left Afghanistan, leaving the people to this situation," Abdullah Abdullah, who heads the government's peace process, said in a video message.
Ghani was elected in 2014 on promises to remake Afghanistan.
But the 72-year-old may ultimately be remembered for making little headway against the deep-rooted government corruption that likely underwrote his demise.
In his last years in office, Ghani watched as he was first cut off from talks between Washington and the Taliban that paved the way for the US exit from Afghanistan, and then forced by his American allies to release 5,000 hardened insurgents to lock down a peace deal that never materialised.
Dismissed as a "puppet" by the Taliban, Ghani was left with little leverage during his final months in the presidential palace, and resorted to delivering screeching televised diatribes that did little to improve his reputation with Afghans.
He has variously been described as visionary, short-tempered, academic, and overly demanding.
Before becoming president in 2014, Ghani enjoyed a stellar career abroad as an academic and economist focused on failed states, only returning 24 years later to pursue his dream of rebuilding the country.
He studied at New York's Columbia University, before teaching in the United States during the Soviet occupation of Afghanistan in the 1980s.
He worked with the World Bank from 1991, becoming an expert on the Russian coal industry, and finally moved back to Kabul as a senior UN special adviser soon after the Taliban were routed in late 2001.
In the days that followed, he was a key architect of the interim government and became a powerful finance minister under President Hamid Karzai from 2002 to 2004, campaigning hard against burgeoning corruption.
Renowned for his intensity and energy, Ghani introduced a new currency, set up a tax system, encouraged wealthy expat Afghans to return home, and cajoled donors as the country emerged from the austere Taliban era.
But he also earned the divisive reputation that dogged him until the end.
"He never allowed anyone to get too close, remaining aloof," wrote veteran author Ahmed Rashid, who has known him for nearly three decades.
"Unfortunately his explosions of bad temper and displays of arrogance with fellow Afghans and Westerners were all too frequent and soon made him a loathed figure."
Ghani is married to Rula, whom he met while studying for his first degree at the American University in Lebanon, and has two children.
He maintained a disciplined daily routine since losing part of his stomach to cancer, leaving him to nibble on snacks as he is unable to digest a full meal.
After performing poorly in the 2009 election, Ghani shocked many Afghans in 2014 by winning after choosing as a running mate General Abdul Rashid Dostum, an Uzbek warlord accused of numerous human rights abuses.
A Pashtun, he started using his tribal name Ahmadzai a couple of years ago to underline his background, though he stresses the importance of unifying Afghanistan's disparate ethnic groups.
"I'm not going to have an isolated life," Ghani told AFP in an interview before he became president, but in the end he did exactly that -- increasingly confined to the presidential palace with only a handful of trusted aides.
In his Facebook video message, Abdullah -- a long-time rival -- suggested Ghani would be harshly judged.
"God hold him accountable, and the people will have their judgment," he said.