Two countries, Iran and Saudi Arabia, have long borders with Iraq, seat of a growing battle against Islamic State militants. Despite the huge stakes for both border countries, only Saudi Arabia is now welcome as part of a U.S.-driven coalition of nations girding for a long fight.

The question of Iran’s participation has become a distraction for the Obama administration as it seeks to build a diverse international support base for a military and diplomatic campaign against militants who have laid claim to territory in Iraq and Syria.

Secretary of State John F. Kerry says Iran should not attend a conference about the militant threat that will be held Monday in Paris, although invitations are up to France.

“It would not be appropriate given the many other issues . . . with respect to their engagement in Syria and elsewhere," Kerry said Friday. He cited Iran’s military support for Syrian President Bashar al-Assad and alleged Iranian support for terrorist groups elsewhere. The United States and some Arab states are backing rebels trying to unseat Assad.

But the United States is trying to exclude Iran from the group for a more simple reason: If Shiite power broker Iran were present, Sunni power broker Saudi Arabia would bolt. So would other Sunni states that provide crucial regional backing for what might otherwise smack of another unilateral U.S. military intervention in the Middle East.

Inviting Iran to participate in the military and diplomatic effort that President Obama launched last week might also antagonize congressional critics of the separate U.S. effort to strike a landmark nuclear deal with Iran this fall. Republican hawks and pro-Israel Democrats alike have accused the administration of being too generous in negotiations now running up on a November deadline.

Iran is indisputably a major player in whatever happens next in Iraq and Syria, and as the Islamic State has eclipsed both the rebel war in Syria and sectarian fragmentation in Iraq as the most instant threat, Iran finds itself on the same side as the United States and Sunni Arab states it considers adversaries.

Whether Iran is part of the formal coalition or not, that common cause makes many in the United States and Iran nervous. It may also offer a new sphere of cooperation for the two nations, estranged since 1979. Both Iran and the United States see the Islamic State as a looming threat best addressed swiftly, although it’s not clear that Iran would go along with unilateral U.S. airstrikes in Syria.

On Thursday, Iran’s Foreign Ministry said the international alliance against the Islamic State is “shrouded in serious ambiguities.”

Iranian President Hassan Rouhani was quoted by Iranian media Friday as saying it is “naive” to suppose that terrorism can be eradicated by airstrikes.

“Fighting terrorism needs organized planning, bilateral and multilateral cooperation and elimination of economic and cultural poverty,” Rouhani said.

It is conceivable that Iran could play the role of middleman, however, to allow coordination of airstrikes that strategically benefit Iran’s ally Assad.

Washington insists it will not ask Assad’s permission to go in and says any action inside Syria would be in pursuit of U.S. goals, not the Syrian government’s. Still, last week Assad’s government appeared to dangle the possibility of cooperation.

U.S. aircraft have carried out more than 150 strikes in Iraq since early August, at the invitation of the Iraqi government.

U.S. and Iranian diplomats are to meet next week during the annual gathering of the U.N. General Assembly, where the nuclear issue, not the militants, is the main focus.

For now, however, both nations are keeping their distance and Washington is straining to keep Iran out of the equation as much as possible.

Iran’s role went unmentioned Wednesday in Obama’s prime-time address , which laid out a strategy for defeating militants who beheaded two Americans in recent weeks. By contrast, the White House announced that Obama had called Saudi King Abdullah hours before the speech, and Kerry made stops in Iraq and Saudi Arabia last week to rally Sunni support.

About a dozen Muslim nations are involved so far, including Egypt, which Kerry visited Saturday. All see the Islamic State as an insurgent threat to their authoritarian governments, and most have, at best, a wary, distant relationship with Iran.

A senior State Department official traveling with Kerry told reporters that Iranian influence in Iraq and Syria is “worrisome” to the Sunni states, and that both of those countries and the United States are keeping a close watch on Iran.

“We are very aware of what Iran is doing in Iraq, but let me stress that we’ve had no coordination with them on the ground whatsoever,” said the official, who spoke on the condition of anonymity to discuss the behind-the-scenes diplomacy.

Egyptian Foreign Minister Sameh Shoukry, asked whether Iran should be part of the coordinated response, appeared to leave the door open.

Fighting terrorism, he said, is “the collective responsibility of all members of the international community.”

Shoukry and several other Arab diplomats are to attend the session Monday in Paris. Although French diplomats had earlier indicated that Iran would be included, U.S. opposition has appeared to scuttle that plan. There has been no public invitation.

“Almost every country has an ability to play some kind of a role in this fight against ISIL and to join this coalition, one way or another,” Kerry said on Saturday in Cairo, using an alternate acronym for the Islamic State. “We are committed to working with nations in every corner of the globe.”

He did not mention Iran.