Updated

The troubled U.S. alliance with Afghan President Hamid Karzai hit a new low with his startling accusation that America is colluding with Taliban insurgents to keep Afghanistan weak. But with President Barack Obama committed to two more years of U.S. combat, Karzai appears to believe he can have it both ways — gain favor at home with anti-American rhetoric and still enjoy foreign military protection.

And he is probably right.

The Obama administration has calculated that it must stay the course, gradually handing off security responsibility to Afghan forces and then ending the combat mission in December 2014. Departing sooner would risk a collapse of the government, a return to power for the Taliban and perhaps a boost for al-Qaida.

Just last month, Obama announced that he would bring home 34,000 U.S. troops in the coming year, leaving about 32,000 for a final withdrawal in 2014. He is expected to announce soon a post-2014 military mission for several thousand American troops, even though he has said that by then "our war in Afghanistan will be over."

"Beyond 2014, America's commitment to a unified and sovereign Afghanistan will endure," he said Feb. 12, though the nature of that commitment will shift to training Afghan forces and pursuing remnants of al-Qaida and its affiliates.

But the latest string of Karzai moves — coupled with the resumption of deadly Afghan army and police attacks on their supposed American partners — could raise new questions about the wisdom of prolonging a war that has cost the U.S. more than 2,000 lives and hundreds of billions of dollars, with no decisive end in sight.

In his eight years as president, Karzai has often upset the Americans by questioning their motives. In June 2011, for example, he likened the Americans to occupiers, saying they were not in Afghanistan to help Afghans but were present "for their own purposes, for their own goals, and they're using our soil for that." Karl Eikenberry, the American ambassador in Kabul at the time, called the remarks hurtful and inappropriate.

A year earlier, Karzai threatened to quit the political process and join the Taliban if he continued to come under outside pressure to reform. He also accused Americans of conspiring against him in the 2009 elections.

Nick Mills, a Boston University professor who wrote a 2007 book on Karzai, said Monday the Afghan president's latest broadside, alleging U.S. collusion with the Taliban, might have been his way of testing the new U.S. defense secretary, Chuck Hagel.

"But when Karzai resorts to these wild, irrational outbursts it may be simply that he's been driven to irrationality by the pressures of the job," Mills said. "I have said for some time that he was never the strong leader Afghanistan needed, and these outbursts underscore his weakness. I think he operates in panic mode at times."

Karzai's term ends next year, and he has said he won't run in the election scheduled for spring 2014.

Far fewer U.S. troops are dying in Afghanistan this year, but the war remains costly and the Taliban have proven a resilient force. Hagel saw proof of this on his weekend visit. There were suicide bombings and, on Monday, a machine-gun attack by an Afghan national police officer that killed two Americans and two Afghans and wounded nearly two dozen others.

Last Friday an Afghan believed to be a soldier opened fire at a U.S. base, killing an American civilian contractor.

Hagel's visit to the war zone — his first since becoming Pentagon chief last month — also brought to the fore a dispute with Karzai over the planned transfer of a U.S.-run detention center to Afghan control. The transfer, scheduled for Saturday, was canceled at the last minute, apparently because of American fears that many of the prisoners would be released as soon as the Afghans were given control.

Hagel also had to wrestle with Karzai's demand that all U.S. special operations forces leave Wardak province by Sunday. Karzai had expressed outrage at what he called the abuse of Afghan civilians in Wardak by special operations units under U.S. control. The Monday machine gun attack was at a base in Wardak.

On Sunday, prior to a scheduled news conference with Hagel in Kabul — canceled, officials said, because of security concerns — Karzai asserted that two suicide bombings that killed 19 people on Saturday were evidence that the Taliban and the Americans were working in concert.

"The explosions in Kabul and Khost yesterday showed that they are at the service of America and at the service of this phrase: 2014. They are trying to frighten us into thinking that if the foreigners are not in Afghanistan, we would be facing these sorts of incidents," he said during a nationally televised speech about the state of Afghan women.

That brought a rebuke from the U.S. ambassador.

"The thought that we would collude with the Taliban flies in the face of everything we have done here and is absolutely without foundation," Ambassador James Cunningham said Monday. "It is inconceivable that we would spend the lives of America's sons, daughters, and our treasure, in helping Afghans to secure and rebuild their country, and at the same time be engaged in endangering Afghanistan or its citizens."

___

EDITOR'S NOTE — Robert Burns has covered national security issues for The Associated Press from Washington since 1990.

Follow Robert Burns on Twitter at http://www.twitter.com/robertburnsAP