Israel has been quietly building intelligence and military links with oil rich Azerbaijan, a largely secular Muslim state, since the collapse of the Soviet Union two decades ago.
The Israelis sell significant amounts of weapons and unmanned aerial vehicles to the government in Baku, on the Caspian Sea, as its intelligence services dig in along the border with Iran.
That gives Israel a forward operating base to monitor Iran, particularly its contentious nuclear program, which Jerusalem views as a major existential threat.
Over the last two years, tensions have escalated as Azerbaijan has become part of the shadowy intelligence war between Iran and Israel. It has become even more important to Israel since its May 2010 rift with former ally Turkey, which also borders Iran.
Even so, the unusually aggressive outburst by Gen. Hassan Firouzabadi, chief of Iran's armed forces Joint Staff Command, Aug. 9 struck a particularly jarring note and brought into sharp focus a little-known aspect of Israel's deepening intelligence war with Iran.
It also reflected Tehran's growing alarm at Israel's penetration of Iran's northern neighbor.
In what was perceived as thinly veiled threat, Firouzabadi accused Baku of mistreating religious Shiites in southern Azerbaijan who lean toward the Islamic Republic and allowing "Zionists" access to Azerbaijani territory right on Iran's doorstep.
"If this policy continues, it will end in darkness and it will not be possible to suppress a revolt by the people of Aran," or Azerbaijan, the general declared in an interview with Iran's semi-official Mehr news agency.
Relations between Iran and Azerbaijan have been under strain in recent years, largely through Iranian covert operations.
In 2007, Azerbaijan convicted 15 Iranians and Azeris for spying on Israeli, U.S. and British interests, including oil facilities, for Tehran and plotting to seize power.
In 2008, Azeri authorities, aided by Israel's Mossad spy agency, thwarted a plot involving operatives of Hezbollah, Iran's powerful Lebanese proxy, to blow up the Israeli Embassy in Baku.
That plot was intended to avenge the assassination of Hezbollah's iconic security chief, Imad Mughniyeh, in Damascus earlier that year. Tehran blamed Mossad for that killing.
Firouzabadi's statement jolted the Iranian leadership as much as it did the Azeri government. Senior Iranian figures publicly chastised the general and sought to distance Tehran from his remarks.
"It is important to note that the ongoing power struggle in Iran" between President Mahmoud Ahmadinejad and the clerical establishment led by Supreme Leader Ayatollah Ali Khamenei, "has been having the unintended effect of creating more political space for the military leadership to assert its views," the U.S. global security consultancy Stratfor observed.
It said "the tense exchange between Tehran and Baku … underscores the growing conflict of interests between the two neighbors as Azerbaijan works on strengthening its relationship with the West."
Around 85 percent of the population of Azerbaijan, ringed by key regional players Iran, Turkey and Russia, is Shiite. That gives Tehran the opportunity to make sectarian mischief in the Caucasus and the energy-rich Caspian Basin.
However, Azerbaijan is overwhelmingly secular, except for the religious conservatives on its southern flank. The government of President Ilham Aliyev suspects Tehran is them to bolster its claims to Azerbaijan's Caspian energy reserves.
Iran fears Aliyev, backed by Israel and even the United States, could support a revolt by its Azeris, who comprise about one-quarter of the population.
So it supports Azerbaijan's regional rival, Armenia, in its deadlocked dispute with Baku over Nagorno-Karabakh, currently held by Armenia.
"Given that Azerbaijan's relations with Iran have long been fraught, the Azerbaijani government has not had any qualms in developing a strategic relationship with Israel," Stratfor noted.
Expanding that military and intelligence relationship to upgrade Azerbaijan's capabilities and develop a military industrial complex there is one of Tehran's greatest concerns.
Aliyev is looking toward Israel and NATO to help modernize its forces, despite a U.S. arms embargo in place since 1992.
Israel is Azerbaijan's fourth largest trading partner. The Jewish state has also been making inroads into the former Soviet republics of Turkmenistan and Kyrgyzstan. It's negotiating with Kazakhstan to upgrade its military.