THANKS to its bewildering president, Afghanistan has seen relations with the United States plunge to new lows just two months before a presidential election. If Hamid Karzai cannot reach an agreement with America for some troops to stay, then NATO is scheduled to pull out completely by the end of the year. Thus, though Mr Karzai will step down at the end of a possibly drawn-out process of choosing his successor, his unpredictability, and his desire to settle scores before going, threaten his country's interests far into the future.
Confirmation of serious trouble came first in November, on the occasion of a loya jirga, a grand assembly of 2,500 community leaders and tribal elders. The meeting was convened to approve a bilateral security agreement (BSA) with America that will allow a small number of foreign troops to continue training and assisting Afghan security forces. Without their presence, many Afghans fear that flows of foreign aid will dry up and that, unable to resist the Taliban, the state might collapse.
The BSA had taken nearly a year to negotiate, and the loya jirga overwhelmingly endorsed it. Yet Mr Karzai used the occasion to attack his American allies for myriad perceived failings and to announce new conditions for his signing the pact. He also suggested that the responsibility for doing so should probably fall to his successor. (Mr Karzai is constitutionally barred from contesting another term.)
Since then, Mr Karzai has continued to give free rein to his resentments. On January 25th he held a press conference in which he excoriated the Americans further. He accused them of engaging in a "psychological war" in their efforts to seal the BSA and acting as a "rival" rather than as a friend. For good measure, Mr Karzai insisted that America must start serious peace talks with the Taliban--an impossibility, given the Taliban's hostility to the BSA. If the Americans would not accept his conditions, he added, "they can leave anytime and we will continue our lives".
Mr Karzai has also gone out of his way to raise the temperature over two other issues. The first is over civilian deaths from a NATO bombing strike on January 15th on the village of Wazghar in Parwan province north of the capital, Kabul. The second is a dispute over the release order of 88 detainees at Bagram prison, which America handed over to Afghanistan last year. Angry American officials say that 17 prisoners to be freed were involved in making bombs that killed 11 Afghan soldiers and they claim that most of the other detainees also have blood on their hands. But Mr Karzai describes Bagram as "a place where innocent people are tortured and insulted and made dangerous criminals".
The row over what exactly happened at Wazghar has become both toxic and farcical. NATO says it was the Afghan army that called in the strike when its soldiers were under heavy fire from Taliban positions in two village compounds. NATO acknowledges that civilians, including two children, died in the action. But it says the lives of dozens of Afghan soldiers and a handful of American advisers were at risk. As it is, an Afghan and an American soldier were killed. But a report commissioned by Mr Karzai asserted that 13 villagers had died after relentless bombing, with not a Taliban fighter to be seen. America, in other words, was guilty of a war crime.
When local news outlets and the New York Times questioned the veracity of the report, carried out by a virulently anti-American MP, the government brought several villagers to Kabul to back up its claims. The move backfired. A photograph was produced purporting to show a funeral for dead villagers. But some in the media thought the photograph looked familiar. In reality, it had been taken a couple of hundred miles from Wazghar--in 2009.
To the consternation of American officials, Mr Karzai now appears to be compiling a list of insurgent-style attacks which he claims the Americans were behind as part of a plot to undermine his government and destabilise the country. The list apparently includes an attack on January 17th on a Kabul restaurant that killed 13 foreign civilians and at least seven Afghans and had been immediately claimed by the Taliban.
Mr Karzai may even believe some of his outlandish assertions. Cocooned in the presidential palace, he receives delegations of elders from around the country only too happy to peddle eccentric theories. On January 27th James Cunningham, America's ambassador in Kabul, portrayed Mr Karzai's views as "deeply conspiratorial" and "divorced from reality".
Mr Karzai's behaviour is, unsurprisingly, having a corrosive effect in Washington, DC. Last week Congress halved proposed development aid to Afghanistan for the coming year, ruled out big new infrastructure projects carried out by the armed forces, and cut by three-fifths the Pentagon's $2.6 billion bid to add "critical" capabilities to the Afghan security forces. The White House appears to have accepted the cuts without a murmur.
How much President Barack Obama's exasperation with Mr Karzai now threatens America's commitment to a security agreement is unclear. In his state of the union speech on January 28th, Mr Obama said that, with an agreement, America would stand by Afghanistan and keep on a "small force" of Americans who, with NATO allies, would train and help Afghan forces in other ways and go after what remains of al-Qaeda.
He appears to have heeded advice he received from the senior American commander in Afghanistan, General Joseph Dunford. General Dunford took the unusual step of going to the White House a day before the speech to plead for the president to agree to keep 10,000 American troops in Afghanistan after 2014 (backed by a further 2,000, mainly from Germany and Italy). General Dunford's plan is supported by the defence secretary, Chuck Hagel; the secretary of state, John Kerry; the CIA director, John Brennan; and the chairman of the joint chiefs of staff, General Martin Dempsey. They argue that this force is the minimum that can accomplish anything and still be capable of protecting itself.
In a bid to make the plan more palatable to Mr Obama, General Dunford suggested that the "enduring force" need only stay for two years rather than the possible decade envisaged by the BSA. That would allow the president, on leaving office in 2017, to claim that he had brought all of America's troops home from two wars. But other voices in the White House, not least Joe Biden, the vice-president, would prefer a much smaller force, devoted only to counter-terrorism. The longer the signing of the BSA is delayed, the more likely the enduring force is to be whittled down. Military advice would then quickly swing to the "zero option" of no troops at all.
What the Americans, and indeed many Afghans, appear to be hoping is that even if Mr Karzai must now be written off as hostile, his successor will want to sign the security pact. It looks a reasonable bet. According to Lotfullah Najafizada of Tolo News, the BSA is supported by most Afghan government ministers, the heads of the security forces and all the main presidential-election candidates.
A two-month election campaign opens on February 2nd, and most pundits see it as a four-horse race between a former foreign minister, Abdullah Abdullah, a candidate in 2009 and no ally of Mr Karzai, and three others who hope to gain the outgoing president's still-useful endorsement: Ashraf Ghani, a former World Bank official; Zalmay Rassoul, another former foreign minister; and Qayum Karzai, an elder brother of the president. All are considered more pro-Western than Mr Karzai and understand the importance of keeping some foreign troops in the country to help the fast-improving but still fragile Afghan army in its dogged fight against the Taliban.
The worry, however, is that the election will go to a second round and that no winner will emerge until June. The new president will then have to concentrate on putting together a government seen as reasonably legitimate and competent. That could push the likely date for signing the security agreement to early August, dragging out the uncertainty (there are already signs of capital flight) and frustrating military planning. American and other NATO commanders still think it will be doable--so long as Mr Obama's patience holds up in the face of Mr Karzai's relentless provocations.
Click here to subscribe to The Economist