In his speech this past week after the Iranian missile strikes against U.S. targets in Iraq, President Trump offered his version of the adage that the enemy of my enemy is my friend.

The Islamic State “is a natural enemy of Iran,” the president said Wednesday at the White House. “The destruction of ISIS is good for Iran. And we should work together on this and other shared priorities.”

Trump’s remarks appeared to help tamp down tensions that had skyrocketed after the U.S. strike that killed Maj. Gen. Qasem Soleimani, the head of Iran’s elite Quds Force, last week in Baghdad. But security officials and analysts say Trump may have sent a mixed message: In the same speech, the president spoke about Iran’s “destructive and destabilizing behavior in the Middle East and beyond,” calling the country “the leading sponsor of terrorism.”

“We don’t understand what President Trump really wants,” said a European official, who like others interviewed for this report spoke on the condition of anonymity due to persistent sensitivities over the United States’ handling of the Iran crisis. “Is he going to confront Iran’s meddling in the Middle East and push back on the al-Quds Force’s power? Does he want to prevent that the U.S. would have to carry a larger burden in the Middle East again? Is he offering Iran and the militias a partnership?”

A Middle East intelligence official said Trump’s statement might be perceived by some in Iran as a weakness, projecting apprehension about the U.S.-led coalition’s ability to prevent the Islamic State from gathering more power.

“The problem with his message is that he is telling the Iranians he is worried about the caliphate as well,” the official said. “This is how the radical elements in Iran will interpret it.”

Iran and the militias it controls have played a key role in the fight against the Islamic State. Abu Mahdi al-Muhandis, an Iraqi killed alongside Soleimani, was the deputy leader of the Iranian-backed Popular Mobilization Forces, one of the most powerful forces fighting ISIS in Iraq.

Iranian Foreign Minister Mohammad Javad Zarif stressed in a tweet the importance of Soleimani in the fight against the Islamic State and other extremist groups, saying that killing the “most effective force fighting Daesh (ISIS), Al Nusrah, Al Qaeda et al — is extremely dangerous & a foolish escalation.”

Hassan Hassan, an analyst at the Center for Global Policy, said Trump’s remarks about cooperating against ISIS showed that the United States has limited options against Iran and that he ultimately wants a deal despite his “maximum pressure” campaign.

“It just smacked of weakness, especially in response to what Iran publicized as retaliation for the killing of Soleimani,” Hassan said. “There was a way to let Iran have its symbolic revenge without giving it a political victory by presenting it as a force against extremism.”

In his address, Trump also declared that the Islamic State has been “100 percent” defeated, even as he appealed to Iran to work with the United States in the battle against the group. It is an assertion that he has made previously and that international security officials have widely refuted.

The Islamic State has been largely pushed out of Iraq and Syria but maintains a presence in both countries. The group has carried out attacks in Egypt, Nigeria, Somalia, Yemen and beyond. Its recent activities include a deadly raid on a military base in Niger, a suicide bombing on a military base in Burkina Faso and the killing of French and Malian soldiers in Mali.

“In the last two weeks alone, ISIS has carried out horrible atrocities in West Africa, including the grisly executions of Christians in Nigeria,” said Rita Katz, executive director of the SITE Intelligence Group.

Extremists inspired by the Islamic State also remain capable of attacking the American homeland, as well as U.S. allies and interests in Europe.

Reached via a communications app, an Islamic State member who goes by the nom de guerre Abu Musab said that Trump’s remarks that the group has been defeated were “wishful thinking” and that the activities of Shiite militias and their behavior toward Sunnis in Iraq were what allowed to caliphate to rise in the first place.

“Trump did us a big favor with mentioning a cooperation with Iran against us in his speech,” he said. “So many Sunnis are worried about the Shia and the militias that they might now see us as the only group that can protect them.”