Tamer Badawi, a research fellow at the Istanbul-based Al-Sharq Forum specializing in the political economy of the Middle East with a focus on Iran. Follow him on Twitter @TamerBadawi1.

The first unofficial reactions in Iran to the Saudi-led embargo on Qatar suggested implicit sympathy for Doha. While Iran’s Ministry of Foreign Affairs took an ostensibly neutral stance on the crisis, later developments showed that Tehran was clearly tilting towards Doha in the crisis. The trio’s saber-rattling against Qatar could prove to be a gold mine for Iran amid the Trump administration’s continuous diplomatic attempts to isolate Tehran.

Iran’s foreign minister, Mohammad Javad Zarif, flew to Ankara on June 7 to discuss the Gulf crisis with Turkey’s president, Recep Tayyip Erdogan. Two days later, Zarif and his Russian counterpart, Sergey Lavrov, agreed during a summit by the Shanghai Cooperation Organization to present a unified stance on the crisis in the Gulf, reflecting Russia’s interest in preserving Qatar’s investments in its oil sector and maintaining a balance in the region. The same day, German Chancellor Angela Merkel called on Turkey, Iran, and Gulf countries to resolve the crisis. With this wide garnered support, Iran was thereby able to reposition itself as a key stakeholder in the game even though its ties with the Gulf trio are tense—at best—especially with Riyadh.

Qatar’s geoeconomic vulnerabilities, as revealed by the crisis, bolstered Iran’s position given the two countries’ geographic proximity. Iran has already sent large food shipments to Qatar—although much of the airlifted food aid to Qatar is coming from Turkey. With Qatar keen to diversify its food supply sources from now on, bilateral trade between Qatar and Iran will probably increase. In Persian year 1394 (2015-2016), Iran exported only $165.4 million to Qatar in non-oil commodities. Moreover, the crisis may allow Iran to become a regional transportation hub in the future, even though it does not yet currently have the necessary capacity. When Egypt and the three Gulf countries closed their airspace to Qatari airlines, Iran opened its airspace to allow the airlines to redirect their flights to Europe via Turkey.

Standing by Qatar in the face of the immense pressures put on it by its three fellows in the Gulf Cooperation Council, might allow Iran to score several geopolitical gains. By supporting Turkey’s key ally in the Gulf, Iran is broadening the ground that Tehran and Ankara can stand on to cooperate in the region. Some observers think that the renewed Kurdish insurgency by PKK-affiliated militants in Iran can bring both capitals closer, since they are tackling the same issue, though it affects them to different degrees. Furthermore, the Islamic State’s June 7 attacks carried out by Kurdish militants in Tehran will probably lead to increased Iranian security presence in the country’s northwest border region with Turkey. Moreover, for Iran, widening the gap between Turkey, Qatar, and Saudi Arabia could mean that the Syrian opposition will have an even weaker position in future negotiation rounds with the Syrian regime and its backers, as the competition between its sponsors will probably sow further dissension within the opposition camp.

Iran is eager to invest in differences between players in the bloc that is increasingly becoming politically and economically dysfunctional. Unlike the 2014 diplomatic crisis in the Gulf, this crisis will have far-reaching implications for the Middle East’s political configurations.