KABUL, Afghanistan -- The longest shadow in Afghan politics is cast by a traffic post that used to stand in Ariana Square outside the presidential palace: the Taliban hanged Najibullah, the last president of the Communist government, from it shortly after they marched into Kabul in 1996.
That history, and the reality that every modern Afghan leader has been ousted or executed, has surely not escaped President Hamid Karzai as he faces what is expected to be his final year in office, and with the American military pullout well under way.
Seeking a nobler ending than his predecessors after his long tenure in the palace, Mr. Karzai is taking a gamble: intensifying his vilification of his American allies at a critical moment in their Afghan endgame, risking their support for him in order to save himself politically.
Even as his government is negotiating the terms for a lasting American military presence, in just the past two weeks he has ordered Special Operations forces out of a critical province, railed against C.I.A. plots, rejected American terms for handing over detainees and, most recently, even equated the United States and the Taliban as complementary forces working to undermine the government.
Interviews with tribal elders, business leaders, political analysts and diplomats here paint an image of a leader who is desperately trying to shake his widely held image as an American lackey by appealing to nationalist sentiments and invoking Afghanistan's sovereignty.
Many, however, believe that Mr. Karzai may not fully appreciate the risks he is taking in betting that the United States will commit billions of dollars in military and economic support for years to come despite growing differences with him, the budgetary and economic challenges at home and battle fatigue after a long war.
"Karzai, very confident of the Americans' need to stay indefinitely and with much invested already, believes he has a lot of leverage and can push back as much as he wants because he's gotten his own way in the past," said Saad Mohseni, an Afghan businessman who is close to many in Mr. Karzai's team and runs the Moby Group, an international media company that includes Tolo, Afghanistan's most popular television network.
"The second thing is his legacy: with only 12 months to go, he has this task to change the narrative. Rather than being the person who was installed through the Bonn process," Mr. Mohseni said, referring to a 2001 conference that set up a post-Taliban government, "he wants to be remembered as the guy who kicked out the 'foreigners' -- in this case, the Americans."
American and other Western officials in Afghanistan have bent over backward to reassure the Afghan public -- and Mr. Karzai -- that they will not abandon them as the Russians did. That retreat, in the early 1990s, led to the collapse of the government and the army and, ultimately, to civil war.
Indicators from the White House, though, have not been as sure. President Obama has yet to decide how many troops might stay on after combat units leave at the end of 2014. Many numbers have been floated, but nothing has been determined.
"At what point does dealing with him become such a political pain that people in Washington, in Congress, say, 'Let's rethink the map on this a little bit,' " said one Western official in Kabul. "I don't think Karzai fully understands this -- understands the advancement of U.S. feeling on this," said the official, who spoke on condition of anonymity because of the delicacy of the continuing negotiations.
Many Afghan observers say that Mr. Karzai is trying to keep himself politically potent during the last year of his term by playing to at least three Afghan constituencies: his ethnic Pashtun base; ethnic Tajik and Hazara leaders in his government; and, notably, the Taliban, who have rejected negotiations with him.
In past speeches, Mr. Karzai has sometimes adopted a yearning tone as he has expressed a desire to be the Afghan leader who could unite the country's factions, including bringing the Taliban in from the battlefield.
And in his recent banning of American commandos from Wardak Province, a Taliban stronghold, some Afghan observers see an attempt to reach out to the insurgents by proving that he has the power to halt military action against them. Others believe he is trying to tap into Afghans' frustrations with giant foreign military vehicles on their roads, heavily armed foreign soldiers on foot patrols in their fields and night raids on their homes.
But since his words have had only limited effect on the Americans, they increasingly ring hollow to many Afghans. At the same time, the reality on the ground has changed: increasingly, the war is being fought -- and in some cases abuses are being carried out -- by Afghan forces that are seen as acting in Mr. Karzai's name despite having been mostly trained by Americans.
That leaves Mr. Karzai casting about for new ways to prove that he is not, as the Taliban insist, "America's chief puppet."
"President Karzai would like to portray himself as a national hero," said Malek Sitez, an adviser to the Civil Society and Human Rights Network of Afghanistan. "He is kind of taking an antiforeigners policy, and many ordinary people in Afghanistan like this. But he does not understand how he, and his government, is totally dependent on the international community economically, and he doesn't understand the impact of his speeches on the relationship."
Still, Mr. Sitez added, if Mr. Karzai cannot be remembered as a hero, "he would like to be remembered as a victim of a crowd of international strategies."
"He doesn't want to be remembered as a defeated politician," Mr. Sitez said. "So he wants to remind people that he's a nationalist -- he kicked out foreigners."
Many here see an echo in the last chapter of Najibullah's rule, when, after the Russians decided to withdraw, the president took an increasingly nationalist stand and even told the Russians to go and just leave the financing for the military. That is very much the message Mr. Karzai has sent to the Americans and the world, Mr. Sitez said.
For Afghans at a more grass-roots level, there is little faith in either the Afghan government or the Americans.
"Now Karzai is trying to deceive people that he sympathizes with the Afghan people, and also he is trying to show the Taliban that 'now I am independent from the Americans,' " said Hajji-Abdul Majeed Khan, a tribal elder from Arghistan, a district in Kandahar Province where Mr. Karzai has had support.
"I don't think that Karzai and Americans have disputes at all -- they both are playing a double game to throw dust in people's eyes and bring another stooge government to Afghanistan," he added.
One elder in Khost Province, in southeastern Afghanistan, suggested that Mr. Karzai's negative comments were much more personal than universal. "All Afghans do not share his views and ideas," said the elder, Yusuf Entezar. "Let's not forget that for a long time there has been a lot of disagreement between Karzai and the Americans on one hand. And he has failed to strengthen the rule of law, and now he is trying to find some accomplishments he can show to people."
Many Afghans who hold government or tribal authority have also come to rely on the development projects and security provided by American soldiers and civilians.
"This is political talk," said Hajji Agha Lalai, the head of the Kandahar provincial council and one of the few allies of Mr. Karzai's who was willing to speak to a reporter about the president's comments. "These kind of remarks being made by Karzai make people worry about the future of Afghanistan."
He added: "People are still hopeful for a better future in Afghanistan, but we need the world community, and we are a fragile country and vulnerable. So the relationship that has been built with the world community should not be broken."
Any American complaints at Mr. Karzai's latest remarks, in which he all but claimed collusion between the Taliban and the Americans, pale next to the Taliban's reaction.
They issued a searing response late Monday in which they dismissed Mr. Karzai as an abject hypocrite, eating food and wearing clothes paid for with American dollars.
Nationalism "neither rescued Najibullah nor will it rescue Karzai; the Afghan nation is one of the nations of the world that knows its puppets and its heroes," said the Taliban statement, which was written by a man identified as Qari Habib.
"Hamid Karzai, at the end of his tenure, has resorted to the same hypocrisy as Dr. Najibullah," the statement continued. "We offer him free advice: Do not take this road, because this road leads to Ariana Square."
Taimoor Shah contributed reporting from Kandahar, Afghanistan; Sangar Rahimi from Kabul; and Farooq Jan Mangal from Khost, Afghanistan.
This article originally appeared in The New York Times.