Kabul: As he contemplates retirement next year, Afghan President Hamid Karzai appears to have one over-riding ambition -- to ensure that his people do not remember him as a puppet of the United States.
Mr. Karzai will stand down after elections in April 2014, and his final year in office promises to be turbulent as he launches strident criticism of the US government, which has backed him since the fall of the Taliban in 2001.
In the latest of a series of verbal attacks, this week he accused the United States of colluding with Taliban militants to justify the presence of 100,000 international troops in Afghanistan.
Mr. Karzai has a record of inflammatory outbursts which his detractors say are evidence that he is unstable, unreliable and prone to off-the-cuff remarks that make little sense and cause serious damage.
But others say his words are carefully chosen and speak directly to Afghanistan's young, often illiterate and poorly educated population.
One independent observer with a recent insight into Mr. Karzai's state of mind is British historian William Dalrymple, who spent 90 minutes discussing his new book with the president at a private audience in Kabul last week.
"I was in Pakistan beforehand, and everyone there from the foreign ministry downwards told me he was a nutter and off his trolley," Dalrymple told AFP.
"British diplomats told me that he was at best 'emotional'. My own impression was that he is a charismatic, erudite and very intelligent man who knows exactly what he is saying."
Dalrymple said Karzai had spoken of the fate of Shah Shuja, the puppet leader whom British colonialists put on the throne in Kabul in 1839 and who was later assassinated.
"His view was that the US were doing to him what the British had done to Shah Shuja, which was to treat him as a puppet and to use him for their own interests," Dalrymple said.
"Karzai thinks Shah Shuja didn't stress his independence enough, and... I do think he is concerned with his legacy."
Dalrymple also said that during their meeting Mr. Karzai aired the allegations that the US and Taliban were somehow acting in concert -- remarks that were to blind-side US officials when the president repeated them in a public speech on Sunday, during a visit by new Pentagon chief Chuck Hagel.
Mr. Karzai, now 55, was a darling of the West when he became leader of Afghanistan after the US-led invasion that ousted the Taliban.
Speaking perfect English, moderate in his views and stylishly dressed in a tunic and lambskin hat, he charmed then US president George W. Bush, who praised him as a man of "honour, courage and skill".
But US-Afghan ties became increasingly strained as the bloody Taliban insurgency gained pace, American casualties mounted and Karzai's government became a by-word for corruption.
Now, with the US-led military operation winding down, Karzai appears happy to cross his biggest overseas backer and eager to secure a reputation as an Afghan leader who stood up to foreign powers.
In recent weeks he has ordered US special forces out of the key province of Wardak, banned international troops from university campuses due to unproven harassment claims, and stopped Afghan forces from calling in US air strikes.
"These are desperate attempts by President Karzai trying to justify himself before history," Waheed Mujda, a former Taliban government official and political analyst, told AFP.
"His remarks remind me of president Najibullah (leader of the pro-communist government that fell in 1992) who made similar remarks as the Soviets were preparing to leave and who started holding talks with mujahideen fighters."
Like Shah Shuja, Najibullah met an untimely end. When the Taliban seized power in 1996, they hanged him from a traffic light in central Kabul.
Mr. Karzai is also motivated by anger that the Taliban refuse to include him in any peace talks and further delays over the handover of Afghan detainees held by the United States -- an issue he has made a symbol of national sovereignty.
For ordinary Afghans, his attacks on Washington echo their own outrage over civilian deaths caused by coalition operations, night raids and a sense that foreign troops trample on local culture.
"Over the past few years, the trust between Karzai and the US administration has completely faded," said Waheed Wafa, director of the Afghanistan research centre at Kabul University. "What he says now shows his frustration."
US political and military officials were stunned by Karzai's accusation that they collude with the Taliban, and furious lawmakers in Washington said he could pay a heavy price.
Senior Republican Senator Lindsey Graham spoke of his "disgust and resentment" at Karzai, and warned that he could support a withdrawal of US funding for his government.
"I am perfectly capable of pulling the plug on Afghanistan," Graham told Foreign Policy.