The recent announcement that Iranian Defense Minister Hossein Dehqan will visit Baku in September is the latest indicator that a thaw in Azerbaijani-Iranian relations is underway.
The first signs of warming relations appeared in early April, when Azerbaijani President Ilham Aliyev visited Iran, where he met with his Iranian counterpart, Hassan Rouhani, and the Supreme Leader Ayatollah Khamenei. While the details of that visit remain murky, a number of agreements were reportedly signed concerning economic and cultural affairs.
The visit marked a significant departure from the tensions that had characterized Azerbaijani-Iranian relations in recent years. Mutual rancour reached the point that officials in Baku publicly complained about Iranian meddling in Azerbaijan's internal religious affairs, while Tehran expressed concern about Azerbaijani strategic cooperation with Israel, the Islamic Republic's implacable foe.
Changing regional dynamics seem to be making a new, more constructive era possible in Azerbaijani-Iranian relations. First, there has been a change of guard in Iran. After years of ideological stridency and a confrontational policy conducted by former president Mahmoud Ahmadinejad’s administration, the election of Rouhani has brought moderates and pragmatists back into the foreign policy establishment. Some of the people now in charge of Iran's foreign relations are veterans of the pragmatist Rafsanjani administration. When confronting the collapse of the Soviet Union back in 1991, the Rafsanjani team's top priority was ensuring stability on Iran's northern borders. It's no coincidence, then, that Rouhani has himself reached out to Baku by emphasizing the need to have good-neighborly relations.
Second, the government in Baku realizes the Obama administration is serious about reaching a nuclear deal with Iran, which might, in due course, promote a broader rapprochement between the two countries. Baku is hedging its bets not to be left on the outside of this potentially momentous strategic shift in the Middle East. This calculation, of course, has implications for Israeli ties. But so far, Baku's tighter relationship with Israel has not brought it any tangible benefits, in terms of bringing Baku closer to its top foreign policy goal of solving the Nagorno-Karabakh conflict with Armenia. Israel has no leverage in this conflict, and for the pro-Israeli lobby in Washington, which was the primary target of Azerbaijani courtship, Nagorno-Karabakh is a non-issue.
Third, both Azerbaijan and Iran have a common interest in preventing a resurgent Russia from expanding and solidifying its influence in the South Caucasus. Russia's annexation of Crimea, along with ongoing confrontation in eastern Ukraine, set alarm bells ringing in Tehran. Despite their overtly good bilateral relationship, Tehran doesn't trust Moscow, given the long history of Russian interference in Iranian affairs. In this sense Iran has a strategic interest in the existence of viable and independent states in the South Caucasus -- Georgia, Armenia and Azerbaijan -- serving as a buffer against Russia.
This desire for a buffer may prompt Iran to play a more active role in Karabakh-conflict resolution. Iran is especially eager to avoid the possibility of renewed warfare between Armenia and Azerbaijan, a development that would not only create instability on Iran's northern border, but also provide Russia a pretext to intervene directly and move closer to Iranian borders. Iran is not a member of the OSCE Minsk Group, which is tasked with leading the currently stalemated peace talks. If Baku plays its cards smartly, it could use its re-established Iranian connections to exert influence on Armenia, given Tehran's warm relations with Yerevan.
Fourth, as recent events in Syria and Iraq show, both Azerbaijan and Iran, as two Shi'a-majority countries, confront a shared challenge in the form of Salafist-inspired extremism and terrorism. About a hundred of Azerbaijanis are reported to have died fighting the regime of Bashar Assad in Syria. Nobody knows how many more Salafist-inspired Azeris have joined "the jihad" in Syria and Iraq. Even if it is a relatively small number, it could mean trouble down the road for Azerbaijan, if some militants return home and decide to use their military experience acquired in Syria and Iraq against Aliyev's administration.
By alienating Iran for a better part of the post-Soviet era, Azerbaijanis themselves have contributed to the emergence of the Salafist problem, but now is the time to address it. The Iranian government, which faces its own Salafi-inspired terrorists in the shape of the Jaish Al-Adl organization operating in predominantly Baluchi areas, can be a vital ally in containing this security threat.
All this makes it clear that there are strong incentives for both Azerbaijan and Iran to improve bilateral relations. At this critical point in time for security and stability in the Middle East, South Caucasus and Russia, these troubled lands need more cooperation, not less.
Eldar Mamedov is a political adviser to the Socialists & Democrats Group in the European Parliament. He writes in his personal capacity.
Eldar Mamedov is a Brussels-based foreign policy expert
Sign up for Eurasianet's free weekly newsletter. Support Eurasianet: Help keep our journalism open to all, and influenced by none.