Iranian officials say they can turn to Beijing and Moscow if talks in Vienna fail to end Western sanctions, but with oil prices falling, China's economy slowing and Russia in its own sanctions-induced slump, Tehran's "plan B" hardly looks ideal.
Talks between Iran and six powers, which include China and Russia as well as the United States and three big EU countries, are expected to fail to reach a deal to lift U.S. and EU sanctions by a deadline on Monday.
While the deadline, already extended in July, could be extended again, Iranian officials have said they are working on an alternative if the talks collapse altogether, which would see them look east and north for diplomatic and economic support.
"Of course we have a plan B," a senior Iranian official told Reuters. "I cannot reveal more details but we have always had good relations with Russia and China. Naturally, if the nuclear talks fail, we will increase our cooperation with our friends and will provide them more opportunities in Iran's high-potential market."
He added: "We share common views (with Russia and China) on many issues, including Syria and Iraq."
China is the biggest buyer of Iranian oil and one of the few countries to continue absorbing large volumes of Iranian exports without any big decrease since U.S. and EU sanctions were tightened in the past three years. Russia has sold Iran weapons, built a nuclear power station and could provide technology.
Both countries can provide diplomatic cover at the U.N. Security Council, where they wield vetoes that can help prevent sanctions from be widened.
Still, the help has serious limits: China has demanded steep discounts for buying Iranian oil, and is likely to pay even less now that its own demand for oil is softening and the global price is tumbling. Russia has no use for Iranian oil and is suffering its own sanctions over the Ukraine crisis.
If the nuclear talks collapse completely - an outcome none of the parties wants - neither China nor Russia can stop the United States and European Union from taking unilateral steps outside the United Nations to expand the painful energy and financial sanctions that hobbled the Iranian economy since 2011.
"Some Iranian leaders believe that in case of failure, they can count on their neighbors to skirt the sanctions and bank on big power rivalries to undercut the restrictions, but this strategy's success is far from certain," said Ali Vaez, a senior Iran analyst at the International Crisis Group.
"Likewise, Russia and China have repeatedly sided with the West in isolating Iran. Similarly doubtful is how much more the economy could recover without meaningful sanctions relief, amidst plummeting oil prices."
Still one Western diplomat at the talks said he thought the impetus for Iran to reach a deal was less intense now than last year, due to the limited easing of sanctions already negotiated.
He also cited the eagerness of Western companies to end sanctions and go back to Iran, and European court rulings against some EU sanctions measures.
"The pressure (on Iran) to go for a deal at all costs is less than it was 12 months ago," the diplomat said. "If there's no deal, Iran will turn to China and Russia, as well as some European countries that are prepared to do bilateral business with Iran."
Another Iranian official said there are factions within Iran that are skeptical about deals with the West and prefer alignments with powers like Russia and China which have condemned unilateral U.S. and EU sanctions.
"The president (Hassan Rouhani) is in favor of this deal because he can fulfill his promises to improve the economy but the Supreme Leader (Ayatollah Ali Khamenei) and also the Revolutionary Guards prefer moving towards the East and working with China and Russia instead of the West," he said.