US President Barack Obama and Afghan President Hamid Karzai, allied in war but lacking in personal chemistry, face a critical test next week of whether they can just get along. From Washington to Kabul, the consensus is clear - the two leaders have no choice but to use their White House meeting to move beyond a recent war of words between their governments and try to restore trust and mend frayed relations. How well they do could have implications for the success or failure of Obama's military buildup aimed at stabilizing Afghanistan and fulfilling his pledge to start bringing US troops home in mid-2011. “We don't have the luxury of having a dysfunctional relationship in such an important war,” said Michael O'Hanlon of the Brookings Institution in Washington. “It's time for cooler heads to prevail.” Still, it could be an awkward encounter on Wednesday, just weeks after Obama flew across the world to Afghanistan to lecture Karzai about corruption. After that visit, Karzai and Obama's aides traded public rebukes before Washington finally backed off. The flare-up marked a new low in US-Afghan ties under Obama and was widely seen as a sign the White House was struggling to craft a coherent strategy for dealing with the Afghan president. Obama has broken with predecessor George W. Bush's chummier approach to Karzai but now must find the right balance. Karzai, as a Washington Post foreign affairs columnist wrote, poses a classic dilemma for the United States of “you can't win with him, you can't win without him.” US officials have little faith in Karzai, but alienating the prickly Afghan leader would risk the support they need from Afghans to make Obama's war strategy work. There is no viable replacement for Karzai at this point, and though Washington is increasingly reaching out to other Afghan officials there is little support within the administration for trying to marginalize him. Karzai is just as mindful of how much he depends on Washington for support, aid and even his own survival in the face of a resurgent Taliban. Body language Against this backdrop, every utterance and bit of body language will be scrutinized for signs of tension when the two men meet. Expect smiles, a handshake and the usual diplomatic niceties in front of the cameras. In private, Obama is likely to stick to his arms-length approach of pressing Karzai to do more to crack down on rampant corruption and show Americans he is a reliable partner. Would anyone blame Karzai if he felt a little nostalgic for the Bush era? His close bond with the back-slapping Republican included regular videoconferences, praise and US visits. By contrast, the current US leader, who cultivates a “no-drama Obama” image and relies less on personal diplomacy with foreign leaders, has opted not to become Karzai's pal. Obama advisers believe Bush's embrace gave the Afghan leader too much cover for his failings. While some experts agree, they say it could pay dividends for Obama to develop better rapport with Karzai. Many analysts believe US public pressure tactics became counterproductive after Karzai was declared the winner of Afghanistan's fraud-marred election last year. Incensed at his treatment, Karzai even hosted Mahmoud Ahmadinejad in Kabul and stood by as the Iranian president railed against the United States. After Obama's visit, Karzai responded to heightened US criticism with a series of anti-Western diatribes. That culminated in US news reports - denied vehemently by Karzai aides - that he told a closed-door meeting he might consider switching sides to the Taliban. With critics at home accusing the White House of brow-beating a vital ally, Obama sought to defuse the situation in April when he reaffirmed Karzai's invitation to visit. Learning from mistakes? Some analysts said Obama may have learned a lesson and expect him to put relations on a more even keel. Karzai's recent outbursts were seen as calculated in part to show the Afghan public he is no US puppet. That could also be a subtext during his trip to Washington. “The president must show that he has self-determination and must not be carried away by Obama's patting” him on the back, said Ahmad Shah Ahmadzai, a former Afghan prime minister. Ryan Crocker, former US ambassador to Pakistan and Iraq, urged Obama to cut Karzai some slack. “It is hard to over-stress the challenges that President Karzai faces,” he said. Obama will also be playing to a domestic audience, a public weary of what was supposed to be a “good war” compared to the more unpopular conflict in Iraq. The Democratic president wants to keep Afghanistan from becoming another drag on his party in pivotal congressional elections in November when voter anxiety over high unemployment and a fragile economy is already expected to take a toll.