AMMAN, Jordan – On a recent evening, two of Jordan's top pro-al-Qaida ideologues held court on the rooftop of a villa decorated with strings of lights. Sporting shaggy beards and robes, the Muslim preachers whispered to each other and rose occasionally from plastic chairs to greet supporters.
It would have been hard to picture such a scene just a few months ago, with Abu Qatada and Abu Mohammed al-Maqdisi then being held in Jordanian prisons on security charges. But Jordan's priorities appear to have shifted because of the mounting threat posed by the Islamic State group, an al-Qaida offshoot that has seized large areas of neighboring Syria and Iraq, sending shivers through the kingdom.
Abu Qatada and al-Maqdisi have denounced some of the group's practices as un-Islamic — comments some analysts say have turned the preachers into assets in Jordan's campaign to contain the Islamic State, which is believed to have attracted thousands of followers in the country. Authorities say their release from prison — al-Maqdisi in June and Abu Qatada after an acquittal last week — had nothing to do with politics.
But the clerics' outspokenness points to ways the U.S.-led fight against the group is upending old assumptions in the Middle East. At the core of issue: the Islamic State group is viewed by some Arab governments as an existential threat, creating an unlikely mix of allies and reshaping regional priorities.
Longtime foes such as the United States and Iran now find themselves fighting a common enemy, as do Iraq's Arabs and Kurds — who rarely agree on much. Squabbling Arab states, such as Qatar and its Gulf neighbors, have at least temporarily put aside their differences in the fight against the militants.
One-time rivals "view the Islamic State through a similar lens, that it represents a threat to their national security interests," said Fawaz Gerges, a London-based expert on Islamic movements.
"This tells you the extent to which the Islamic State has really reconfigured regional security and global security," he added.
The coalition has quickly grown since the U.S. first launched airstrikes against Islamic State targets in Iraq on Aug. 8, followed by bombardments in Syria that began Sept. 21.
Saudi Arabia, the United Arab Emirates, Bahrain and Jordan have participated in attacks in Syria, while Qatar hosts an air base used by the coalition. France, the Netherlands, Denmark, Belgium and Britain are among European countries contributing to U.S. efforts to hit the Islamic State group in Iraq.
The shakeup of alliances is perhaps most dramatic in Syria, ravaged by a civil war between President Bashar Assad's troops and Sunni Muslim-led rebels, including Islamic State fighters and al-Qaida's local branch, the al-Nusra front.
A year ago, the Obama administration appeared on the verge of striking government targets in Syria after blaming Assad for a deadly chemical weapons attack on rebel-held areas outside Damascus. Now Assad stands to benefit from U.S.-led airstrikes that are hitting some of his most ruthless enemies while, for now, staying clear of his fighters.
Saudi Arabia and Qatar, among the most active supporters of the armed opposition seeking to topple Assad, are now part of the coalition that appears to be helping him militarily, even if unintentionally. How long they are willing to do so is unclear.
"The coalition is being held together by American resolve, determination and leadership. But we shouldn't take it for granted," said Salman Shaikh, director of the Brookings Doha Center in Qatar.
Qatar's participation in the coalition is significant. It has been under mounting political pressure over its backing of Islamist groups such as the Muslim Brotherhood, its ties with Hamas, which fought a 50-day war with Israel this summer, and for not doing more to stamp out private funding for Islamic State militants.
It now finds itself allied with three Gulf neighbors who pulled their ambassadors from the country earlier this year to protest Qatar's perceived regional meddling and support for Islamists. While the diplomats haven't been formally reinstated, it appears the Islamic State threat is now a more pressing concern.
"This is helping to push the GCC (alliance of six Gulf states) together against the Sunni extremists in Syria," said Theodore Karasik, an analyst at the Dubai-based Institute for Near East and Gulf Military Analysis.
Jordanian government spokesman Mohammad al-Momani predicted a long fight against the Islamic State militants.
"They have been trying to infiltrate into our borders, and therefore the threat is there," he said. "We will continue until we achieve our objective of degrading and finishing the terrorist organization."
The new counterterrorism fight isn't prompting the Obama administration to ease efforts against other long-term threats to the United States. Washington is still pushing for a nuclear deal with Iran and targeting the financing of Hezbollah and Hamas.
But shifting the priority to destroying the Islamic State group is creating new opportunities for indirect collaboration, even with sworn enemies.
U.S. and Iranian officials have held discussions on counteracting the Sunni extremists, although they deny direct cooperation.
In a sign of the overlap of Iranian and U.S. interests, Iran last week said one of the Islamic Republic's most senior generals and 70 Iranian soldiers helped Kurdish fighters defend Irbil, the capital of the autonomous Kurdish region in northern Iraq that has been a focus of the American military. The city is home to a U.S. consulate and offices of numerous Western companies, and the approach of Islamic State militants to its outskirts prompted American airstrikes in August.
Lebanon's powerful, Iranian-backed Shiite Hezbollah militia has used the threat posed by the Islamic State to justify fighting in Syria, alongside Assad's forces. After sending fighters to Syria last year, Hezbollah had faced mounting criticism at home that it was dragging the country into the civil war there.
Hezbollah leader Hassan Nasrallah now argues that Hezbollah's actions have prevented Islamic State militants from overrunning Lebanon.
The new regional climate also helped refocus Egypt's relations with the West on the issue of terrorism, a conversation President Abdel-Fattah el-Sissi appears more comfortable with than Washington's concerns about human rights violations resulting from his domestic crackdown on the Muslim Brotherhood.
El-Sissi deposed an elected president from the Brotherhood last year and has tried to portray his move against the group as a model for fighting terrorism. Washington remains critical of Cairo, but observers believe the ties between the two are improving.
Some in the Arab coalition say they are engaged in an existential battle.
"What we are fighting is not just a terrorist organization, but the embodiment of a malicious ideology that must be defeated intellectually," the vice president and prime minister of the Emirates, Dubai ruler Sheik Mohammed bin Rashid Al Maktoum, wrote in an opinion piece Sunday.
"I consider this ideology to be the greatest danger that the world will face in the next decade," he said.
Schreck reported from Dubai, United Arab Emirates. Associated Press writers Bassem Mroue and Diaa Hadid in Beirut, Bradley S. Klapper in Washington and Maggie Michael in Cairo contributed to this report.
Follow Adam Schreck on Twitter at www.twitter.com/adamschreck