Qatari Foreign Minister Khalid bin Mohammed al-Attiyah attends the meeting of the Foreign Ministers of the Gulf Cooperation Council in June in Riyadh, Saudi Arabia (Fayez Nureldine/AFP/Getty Images)

The U.S. military orchestrates the air war over Iraq and Syria from a hulking command center on the vast al-Udeid Air Base, a Qatari-owned encampment that is home to 8,000 American military personnel and dozens of Air Force jets. Giant video screens inside the windowless, two-story structure allow troops to track every plane and observe live footage from every drone involved in operations against the Islamic State.

Twenty miles to the northeast, in the heart of this opulent and fast-growing capital city, the even more gargantuan Grand Mosque has served as a key outpost for al-Qaeda-linked rebels fighting the Syrian regime. From a pulpit under ringed chandeliers, several clerics have exhorted the faithful to open their wallets in support of Syrian resistance groups. Some of the clerics have boasted of directing money toward Jabhat al-Nusra, which the U.S. government has classified as a terrorist organization linked to al-Qaeda.

Although Qatari authorities have moved over the past year to crack down on private donations to Syrian rebels allied with al-Qaeda and the Islamic State, the government here shows no signs of diminishing its support for Islamist groups across the Arab world that others in the region have branded as outlaws and terrorists.

Qatar’s strategy of backing Islamists — from Hamas in the Gaza Strip, to the Muslim Brotherhood in Egypt, to hard-line Syrian opposition fighters — while also offering itself as a key U.S. ally in the volatile Middle East is rooted in pragmatism: This gas-rich, finger-shaped peninsula that borders Saudi Arabia and juts into the Persian Gulf wants to protect itself by being friends with everybody.

“We don’t do enemies,” Qatar’s foreign minister, Khalid bin Mohammed al-Attiyah, said in a rare interview. “We talk to everyone. We cannot change geography — this is for sure — so whoever is in the vicinity of our geography has to be our close friend.”

(Laris Karklis/The Washington Post)

Attiyah said his nation, which is participating in the U.S.-led coalition to battle Islamic State militants who have seized large swaths of Iraq and Syria, is “an ally to counterterrorism.” But he also made clear that his government possesses different criteria for aiding political and resistance movements than some of its neighbors and its Western friends: “We cannot say everyone who is an Islamist is a terrorist. No.”

The same conciliatory spirit extends to rebels in Libya seeking to topple that country’s democratically elected government, and to Iran, with which Qatar shares natural-gas fields under the gulf. Instead of joining the strident rhetoric of its Arab brethren over Tehran’s nuclear program, the Qataris have sought to pursue a more harmonious relationship, even through Iran backs the government of Syrian President Bashar al-Assad, which has been battling militants financed by Doha.

That approach has vexed other nations in the area, including Saudi Arabia, Bahrain and the United Arab Emirates — which withdrew their ambassadors from Doha earlier this year — and it has prompted some in Washington to doubt Qatar’s reliability as an ally.

“They’re playing a double game,” huffed a senior official of a nearby Arab nation who spoke on the condition of anonymity to avoid exacerbating the diplomatic feud. “The Qataris are the consummate opportunists.”

To the Qatari government, however, it is all about survival. Fearful that the Muslim Brotherhood, the principal movement of political Islamists, might seek to establish a foothold in this tiny sheikdom, leaders here cut a deal of sorts two decades ago: They offered safe haven to Brotherhood members from other countries, and even doled out financial assistance, in exchange for an implicit commitment not to interfere in Qatar.

That policy also allowed the Qataris, who wanted to use their wealth to become more significant players in the Middle East, to step out of Saudi Arabia’s shadow. Instead of relying on their large neighbor to protect them, the Qataris figured they would forge their own alliances.

“Their model has been to be independent from everyone but also a place for everyone,” said Ibrahim Sharqieh, foreign-policy fellow at the Brookings Institution’s Doha research center.

Although Qatar has a modest contingent of fundamentalist Muslims — they hold sway over the Islamic-affairs ministry, which invited the radical clerics to speak at the Grand Mosque — the government’s arrangement with the Muslim Brotherhood does not appear to be rooted in ideology. “It’s a political alliance,” said a well-connected Qatari analyst who did not want to be identified, to avoid jeopardizing his relationships with the ruling family. “They didn’t want to be caught on the wrong side.”

The Qatari approach has been grounded in the belief that Arabs in other nations would eventually seek to displace the autocrats and royal families who have held sway in the region for decades. And, the Qataris figured, the populations of those countries would opt to be governed by new leaders who placed Islam at the forefront of politics.

“In the end of the day, the will of the people will prevail,” Attiyah said. “This we have no doubt about.”

The Qataris, however, do not share the same prediction for political transformation at home. The country is the world’s largest exporter of liquefied natural gas, and those profits have turned this nation into the world’s wealthiest, per capita. Porsches, BMWs and Ferraris ply the newly built expressways. The corniche is lined with gleaming skyscrapers. Manual labor, from cleaning to construction, is performed by legions of foreign workers from India, Bangladesh, Nepal and the Philippines.

Even though the government here is far from democratic — the first general elections for a “consultative assembly” to advise the emir were planned for last year but then indefinitely postponed — there appears to be little groundswell for upending the system. “Everyone is too rich to care,” the analyst said. “Change is something they want to see elsewhere, not at home.”

Backing winners

As the Arab Spring dawned in 2011, with popular revolutions toppling strongmen in Tunisia and Egypt, it looked as if the Qataris had made the right bet back in 1995, when the emir at the time, Sheik Hamad Bin Khalifa al-Thani, set the nation on its friends-with-everyone approach.

He allowed members of the Muslim Brotherhood and Hamas to set up shop in Doha, but he also rolled out the welcome mat for the Americans. In 2002, when the U.S. military decided to begin pulling forces out of Saudi Arabia, he offered his country as a home for the U.S. Central Command’s forward headquarters.

For years, Qatar’s neighbors regarded its activities as idiosyncratic but generally harmless. Egypt, for instance, appeared firmly in the grip of Hosni Mubarak, despite Qatar’s aid to Brotherhood exiles.

Then came the Arab Spring. Mubarak fell, as did the leaders of Tunisia and Libya.

When the Brotherhood won elections in Tunisia and Egypt, assisted by even more Qatari largesse, Doha reveled in a smug satisfaction. “Qatar backs winners,” became a commonly uttered phrase here.

“They saw themselves on the right side of history,” said Gerd Nonneman, the dean of the Doha campus of the Georgetown University School of Foreign Service.

As fellow Sunni Muslims in Syria began to rise up against Assad, Qatar saw another opportunity to foment change, particularly when it became clear the United States was not going to intervene. The Doha government began sending tens of millions of dollars to Syrian rebels through intermediaries in Turkey who used some of the funds to purchase weapons and other supplies, according to Western officials familiar with Qatar’s activities who spoke on the condition of anonymity.

The support had a dramatic impact. Opposition fighters, who also received money and arms from Saudi Arabia, forced Assad to cede control of substantial parts of the country.

Qatari officials knew the Syrian resistance was a motley lot, from secular-leaning exiles to extremists allied with al-Qaeda. The Qataris opted to fund groups that it believed leaned slightly to the religiously hard-line side, reasoning that they would have the best chance of rallying popular support.

But some of the clerics allowed to preach in the Grand Mosque wanted to go even further. They urged Qatari citizens to throw their money behind Jabhat al-Nusra, also known as the al-Nusra Front.

Among them was a Kuwaiti named Hamid Hamad Hamid al-Ali, who has referred to himself as an “al-Qaeda commando,” according to the U.S. Treasury Department, and had boasted of collecting money for al-Qaeda and Jabhat al-Nusra. Ali traveled to Qatar in June 2013 to endorse a fundraising drive for jihadist militias in Syria.

“This is a renowned and well-known campaign,” he said in a speech that was recorded and uploaded to YouTube. “Its activities are also clear, and the mujahideen internally as well speak of their work in terms of what they provide in support.”

At the end of his speech, viewers were provided with an account number at the Qatar Islamic Bank to which they were urged to contribute. A Qatari who ran the fund drive, Saad bin Saad al-Kaabi, subsequently posted a tweet to encourage his friends to contribute. “Your brothers are in dire need of weapons and ammunition more than food,” he wrote.

Two months later, Kaabi’s campaign posted a video of fighters next to a piece of anti­aircraft artillery. They thanked their Qatari patrons “who have gratefully supported us in purchasing this artillery.”

Mixing in the gray areas

Then, just as quickly as Qatar piled up the wins, it saw its victories slip away. The Brotherhood figure elected president of Egypt, Mohamed Morsi, struggled to become an effective leader and eventually was deposed by the military. Libya descended into factional fighting among rival militias. And the Syrian rebels began to turn on one another.

Some of the resistance units that had received official Qatari aid started to ally themselves with Jabhat al-Nusra. The principal beneficiary of the tumult was the hyper-extremist Islamic State, whose ranks swelled with new recruits, allowing the group to outmuscle others in Syria and then surge into Iraq.

Attiyah, the Qatari foreign minister, said the government has not supported the Islamic State. Senior U.S. officials said they possess no information to suggest otherwise.

But U.S. officials and independent analysts who track the conflict in Syria say Qatar’s approach to funding the resistance has been sloppy and unsophisticated. The reliance on Turkish middlemen and Syrian facilitators almost certainly has resulted in money and arms getting into the hands of Jabhat al-Nusra fighters or those allied with them. The Qataris “have very limited experience and capacity to effectively manage an endeavor of this scope,” said a U.S. official involved in Syria policy.

The groups the Qataris chose to support have prompted further concern in Washington and allied capitals. Among them has been a band of fighters called Ahrar al-Sham, which has fought in alliance with Jabhat al-Nusra.

“They’re always one step away from guys we don’t like,” said Michael Stephens, the deputy director of the Doha office of the Royal United Services Institute, a British research organization. “That’s the problem with the Qataris in Syria: They mix in the gray areas.”

The Qataris also moved slowly to crack down on private donations to Jabhat al-Nusra and other extremist resistance groups, according to Western officials who follow terrorism financing. The government here began to restrict funding last year after repeated entreaties from the United States and European nations.

Attiyah acknowledged that his government does not always agree with the United States and its European allies about which Syrian opposition groups should be deemed moderate, but he also blamed the radicalization of the resistance on Western inattention to the crisis.

“We wasted maybe 21 / 2 years classifying people,” Attiyah said. At the start of the conflict, he said, his nation had categorized groups as green, amber and red, based on their connection to extremist organizations. Now, however, “when we went back to the green ones, they are already red. They didn’t have means to defend themselves. They didn’t have salaries. They didn’t have anything. And they have been attracted by the terrorists.”

Proxy war

For Qatar’s neighbors, its activities in Syria do not elicit the same concern as in Washington or European capitals. In Saudi Arabia, Bahrain and the UAE, the anger is focused on Qatar’s role in Egypt and Libya.

Instead of acknowledging defeat after Morsi’s ouster in Egypt, Arab officials contend Qatar has continued to assist Egyptian members of the Brotherhood, which the country’s new government has designated as a terrorist organization, as have Saudi Arabia and the UAE. Attiyah said his country seeks to help “the people of Egypt,” but he insisted that Qatar does not meddle in Egyptian politics.

In Libya, Qatar is backing Islamist militiamen who have seized large sections of the capital, Tripoli, and are battling an anti-Islamist faction backed by Egypt and the UAE.

In recent weeks, the fighting has spiraled into a proxy war. In late August, the UAE sent fighter jets to assist the Egyptians in bombing the Qatari-supported militia. A few weeks later, Libyan officials accused Qatar of flying multiple planeloads of supplies to its militiamen.

Attiyah said his nation is not interfering in the internal politics of Libya. Asked specifically about the resupply flights, he responded, “Did we bomb with our planes?”

For Qatar, the dispute with its neighbors over Egypt and Libya involves a fundamental difference over the role of political Islam in the Arab world. Saudi Arabia and the UAE oppose any Qatari efforts to promote the Muslim Brotherhood or other groups of political Islamists, viewing all of them as a threat to regional stability. To the Qataris, however, Islamists cannot be crammed back into the genie’s bottle by authoritarian regimes. It is better, the Qataris believe, to work with them.

In part to appease its neighbors, however, the government here recently requested that seven Brotherhood leaders leave the country. Attiyah said the move does not indicate a change of policy. If members want to engage in politics in another nation, he said, they need to do it from elsewhere. But if they do not, he said, “we provide safe haven.”

A closer relationship

These days, al-Udeid Air Base is a frenzy of activity, and not just on the flight line, where rows of KC-135 tankers prepare to take off for 12-hour loops over the Persian Gulf to refuel fighters streaking toward Iraq and Syria. The rest of the sprawling, sand-swept base is just as busy — with construction.

Since it set up shop on Udeid, the U.S. military has housed personnel in tents and trailers. Flight squadrons have worked out of hastily assembled metal buildings. The encampment had a transient feel, as if it could be packed up and shut down as fast as a demobilized base in Afghanistan.

To the Qataris, that sent the wrong message, so they asked the Americans to build — and helped to pay for — rows of new concrete-walled buildings, including comfortable living quarters and recreation facilities.

“It’s an expression of commitment,” said Col. Steven DeSordi, the staff director of the 379th Air Expeditionary Wing, the principal U.S. Air Force unit on the base.

The construction is the most visible indication of a military relationship that is drawing closer. In December, the United States and Qatar agreed on a new defense cooperation agreement. Although the terms are confidential, people familiar with it say the deal gives the United States latitude to use the facility for a wide range of operations without seeking prior approval from the Qataris. “It’s like being in the States,” an Arab official familiar with the terms said.

This July, the Qataris agreed to purchase $11 billion worth of U.S. arms, including two dozen AH-64 Apache attack helicopters and 34 Patriot missile launchers. For Qatar, which used to buy most of its weapons from other nations, the sale represented a new desire to collaborate with the U.S. military beyond the use of two bases. The acquisition of those weapons systems will lead to joint training and more integrated military exercises.

“This opens the door to an even closer strategic relationship with them,” said a senior U.S. defense official.

But the Qataris have made it clear that they want equal say in defining the terms of the friendship. When the Obama administration asked them to join with the UAE, Saudi Arabia and Jordan in the coalition to counter the Islamic State, Doha consented. It launched French-made Mirage fighters, but the Qataris did not join the other three Arab countries in dropping bombs. Instead, the Qataris flew air defense patrols in support of the initial rounds of airstrikes.

“They want to participate, but they want to do it own their own terms,” a senior U.S. military officer said.

When the U.S. military needed an intermediary to take temporary custody of five Taliban leaders released from the Guantanamo Bay detention facility in Cuba in exchange for U.S. Army Sgt. Bowe Bergdahl this year, Qatar was the one nation on which the Taliban and the Americans could agree.

“Washington may not like everything we do, but we have been there to help again and again,” the well-connected Qatari analyst said. “You need a friend who is friends with people you don’t want to be friends with.”