The Qataris also back their diplomacy with some eclectic investments. Many Americans know about the emir’s gift of $100 million to help Hurricane Katrina victims, but Qatar is also building a $1.5 billion oil refinery in Zimbabwe, a huge residential complex in Sudan and a $350 million tourist project in Syria.

Some call Qatar’s policy deranged. The Qataris prefer to think of it as useful. Blessed with enormous oil and natural gas reserves, Qatar is surrounded by large and ambitious neighbors: Iran, Iraq and Saudi Arabia. Diplomacy has become a way for Qatar to protect itself and its riches, by forming alliances and by trying to stabilize the region.

“The idea is to try to keep everybody happy — or if we can’t, to keep everybody reasonably unhappy,” said one former Qatari official, who spoke on the condition of anonymity because he was not authorized to discuss foreign policy. “If that makes the Americans or the Russians a little cross, well, tough luck.”

It does make them cross. American officials have been quietly furious about Qatar’s assistance to Iran and Syria, which includes substantial financial investments as well as votes against sanctions on Iran during Qatar’s tenure on the United Nations Security Council. The Americans are also angry about Qatar’s hefty financial aid to the militant Palestinian group Hamas after it won elections in 2006.

“Their relationship with us has been complex, bordering on one of animosity,” said a high-level State Department official, speaking on condition of anonymity so as not to give offense, adding that Qatar’s support for Hamas had been a “very vexatious problem.”

The Russians have complaints too. Qatar provided sanctuary to the Chechen rebel leader Zelimkhan Yandarbiyev until two Russian secret agents killed him in 2004, detonating a bomb in his car as he left a mosque in Doha. The agents were captured by Qatari authorities and convicted of murder, but later extradited at Russia’s request.