Virtually no one in the international community wanted Kurdistan to vote for independence.

In the run-up to last week’s referendum — in which Kurds voted overwhelmingly to break free from Iraq — neighboring Iran launched war games on the border and Turkey’s president openly raised the possibility of an invasion. Both countries threatened crippling economic sanctions, and U.S. and U.N. officials, scrambling to avoid regional instability, warned that independence would spell economic isolation for Kurdistan and possibly spur the re-emergence of ISIS in the region.

The threats came from everywhere — allies and enemies — at a time when Iraqi Kurds face an increasingly untenable debt situation. Yet Kurdistan’s President Masoud Barzani appeared unfazed. He pushed forward on his people’s long-held dream of an independent state and held the vote.

One reason: The people demanded it, with 93 percent ultimately choosing to support independence. But another significant — and overlooked — factor, according to people closely involved in the region’s politics and business, was the economic lifeline extended by another world power who’d otherwise remained notably neutral: Russia.

In the year leading up to the referendum, Kurdistan, a quasi-state in northern Iraq with a disputed degree of autonomy, lined up a string of lucrative oil deals with Rosneft, Russia’s biggest oil company and one with close ties to the Kremlin. The most recent deal came Sept. 18, just one week before the vote.

“If Rosneft hadn’t done that, I don’t think Kurdistan would have gone ahead with the referendum,” said Alan Mohtadi, head of T&S Consulting Energy and Security, which advises companies working in Kurdish oil and gas.

A bold investment

In business terms, oil in Kurdistan is a complicated investment, analysts said. The region boasts 40 percent of Iraq’s oil reserves, but also carries enough geopolitical risk to make many investors nervous. When U.S. powerhouse Exxon entered Kurdistan in 2011, for example, tensions flared as Iraqi and Kurdish troops both deployed to areas where the company planned to drill. Last year, Exxon walked away from three of its six exploration blocks in the area after reportedly failing to meet contractual deadlines. Since 2014, international oil companies have renounced at least 19 oil blocks in Kurdistan, according to an analysis by the Iraq Oil Report.

Yet such an investment fits Rosneft’s profile. Headed by Igor Sechin, a close ally of Russian President Vladimir Putin, the oil giant has demonstrated a high tolerance for controversy ever since snatching up huge oil assets that had been dramatically wrestled away from one-time oligarch and Kremlin nemesis, Mikhail Khodorkovsky. After consolidating its position as Russia’s top oil producer, the company has been expanding aggressively abroad.

“They want to position themselves in places like Kurdistan and Venezuela and take advantage of situations where western companies are fearful to get involved,” said Chris Weafer, a business consultant based in Moscow.

In less than a year, Rosneft has pledged as much as $4 billion to Kurdistan, enough to make the Russian oil giant the autonomous region’s top funder of oil and gas deals, according media reports. Crucially, in February, Rosneft committed to make advance payments for future oil shipments over the next three years — a windfall for cash-strapped Kurdistan.

The Russian energy giant also secured access to Kurdistan’s key crude oil export pipeline in June, as well as production sharing agreements for five oil blocks in undisclosed locations.

For Kurdistan, Rosneft arrived at a crucial moment. The region desperately needed cash. Years of battling ISIS in a time of depressed oil prices had sunk the KRG nearly $20 billion into debt. (Even with Rosneft’s cash advances, Kurdistan is in such dire financial straits that the government is paying as little as 25 percent of the salaries owed to its own civil servants, a government spokesman said.)

An economic cushion

Kurds have dreamed of having their own country for decades, and Barzani came close to a referendum in 2014 before backing down in the face of U.S. pressure and the raging war with ISIS. This time, Rosneft’s economic assurances — and the implicit support of Moscow that came with them — gave Kurdish leaders confidence that they could weather the post-referendum storm, according to sources closely involved in the region’s politics and oil sector.

“Definitely, from a psychological point of view Rosneft’s decision came at the right time,” said Safeen Dizayee, chief of staff to the prime minister and an official spokesman for the Kurdistan Regional Government. “The expectation was that if we hold a referendum, all the foreigners, everybody, will abandon the ship, and Kurdistan will return to isolation, and it will be a failed quasi-state. But with this oil giant coming to the scene, [that] put more confidence in the market.”

Khoshavi Babakr, an envoy to Moscow for Barzani’s Kurdistan Democratic Party, went further. He said Rosneft’s investment provided not only an economic boost but also “was certainly a direct sign of support for the independence of Kurdistan” from the Kremlin.

At least the government of Kurdistan saw it that way, Babakr said. And they are “glad that Russia is taking this position, because we’re in very difficult situation.”

“He thought he would gain the protection of the Russians.”

Officially, Moscow has remained neutral, supporting both the “unity and territorial integrity of the Iraqi state” and also the “legitimate aspirations of the Kurds.” Neither Rosneft nor Russia’s Foreign Ministry replied to emails and phone calls requesting comment for this story.

Saad Al-Muttalibi, a member of Baghdad’s municipal security council, accused Barzani of seeking to entice Russia into supporting Kurdish independence by offering lucrative oil deals to a Kremlin-connected company.

“[Barzani] thinks that having contracts with oil companies provides him with protection,” Al-Muttalibi told VICE News. “He thought he would gain the protection of the Russians.”

Dizayee declined to say explicitly whether the KRG saw Rosneft’s move as a sign of Kremlin support for the referendum. “But of course, in this day and age, politics and economy are two sides of the same coin,” he said. “It may have certain effects, for sure.”

A risky assumption

The budding relationship isn’t without risks for either party. In June, Rosneft secured five oil blocks in undisclosed locations, prompting speculation that the fields might be located in areas still hotly contested between Kurdistan and the Iraqi government, such as oil-rich Kirkuk, which participated in the independence referendum.

“It would be pretty explosive if Baghdad got wind of Rosneft taking control of oil fields in Kirkuk,” an expert on Middle East affairs who asked not to be named due to the sensitivity of the subject told VICE News. “Rosneft could possibly be blacklisted from the rest of Iraq.”

Dizayee, the government spokesman, wouldn’t discuss the exact location of the fields, saying only: “The blocks where they have expressed interest in operating will be available to them without a problem.” When pressed on whether those blocks were in areas disputed with the federal government, he replied, “The so-called disputed areas have been secured and controlled, and [are] presently under the control of the KRG administration.”

But Baghdad may seek to renegotiate the contracts foreign companies have reached directly with Kurdistan, Al-Muttalibi said — a move that would render such political protection moot.

Officials in Baghdad have fumed at Barzani’s decision to proceed with the referendum. After the vote, the Iraqi parliament authorized the prime minister to deploy troops to the region as the government blocked operations with Kurdish banks and instituted a ban on international flights. On Wednesday, the presidents of Iran and Turkey held talks in Tehran about Kurdistan, after which they issued dark warnings of future unspecified actions.