The idea of a grand bargain between the United States and Russia is less popular in Washington than ever before. And yet one of the biggest foreign policy problems for the U.S. — that of North Korea — cannot be resolved without Russia’s participation. In recent years, Russian President Vladimir Putin has made sure to rebuild a close relationship with North Korean dictator Kim Jong Un, and it’s no longer enough to talk to China to mitigate the Stalinist state’s aggressiveness.

Last Sunday, North Korea tested a ballistic missile that might be capable of reaching the U.S. military base on Guam. It fell in the Sea of Japan — according to U.S. reports, just 96 km south of the Russian port of Vladivostok. The White House said in a statement, “With the missile impacting so close to Russian soil — in fact, closer to Russia than to Japan — the president cannot imagine that Russia is pleased.”

Putin’s response was quick and unfriendly. While restating that Russia was against the proliferation of nuclear weapons, including to North Korea, he said Monday:

“We need to go back to dialogue with the Korean People’s Democratic Republic, stop intimidating it and find peaceful ways of resolving these issues.”

“Stop intimidating North Korea” is tougher rhetoric than that used by Chinese Foreign Minister Wang Yi in April, when he urged “all parties to refrain from inflammatory statements and deeds.” Unlike Beijing’s ostensibly conciliatory stand, the Kremlin blames the U.S. for the escalation. With that kind of full-throated support, it’s no wonder Russia was first to receive Kim’s lunar New Year’s greetings this year, before China.

Given that North Korea doesn’t have meaningful economic ties with any country but China makes honoring Russia even more surprising. Trade with Russia hasn’t amounted to more than $100 million a year for more than a decade, though in the 1970s and 1980s the Soviet Union was North Korea’s biggest trading partner, with up to 53 percent of its total trade turnover ($2.2 billion in 1990). The two countries have set a goal to increase trade to $1 billion a year by 2020, but the growth hasn’t quite materialized yet.

Trade, however, isn’t the best way to win trust in the land of the Kims, whose governing ideology, “juche,” is one of self-sufficiency. Russia has lately come through for the isolated country when it needed help.

In May 2014, less than two months after the Crimea annexation and with Western nations seeking to punish Moscow, Putin signed away 90 percent of North Korea’s $11 billion debt to Russia, an amount comparable with the debtor state’s GDP. The other 10 percent, according to the deal Putin signed, could be used for joint Russian-North Korean projects. That same year, Russia delivered 50,000 tons of wheat as humanitarian aid to North Korea.

The North Koreans are also helping with one of Putin’s pet plans, reviving the Far East. About 50,000 North Korean citizens — up from about 21,000 in 2010 — work at construction sites and lumber yards in Russia that are under the open surveillance of the North Korean intelligence services. The North Korean state takes most of the pay they earn, but the remaining share is still so big by North Korean standards that competing for this work — described by the United Nations and human rights activists as slave labor — requires a bribe. If any of the workers get ideas and try to defect, Russian authorities hand them over. Russia’s previous, pro-Western president, Boris Yeltsin, allowed some of the defectors to hide out in his country — but those days are gone.

Russia is pushing to reduce North Korea’s international isolation. In 2013 it finished renovating the railroad link between the two countries and this month ferry traffic opened between Vladivostok and the North Korean port of Rason.

Putin’s Russia never does anything for free, and it can’t hope to get any economic benefits from North Korea on a scale that might interest its oligarchy or its mammoth state companies. Like China, it’s making political investments is a country seen as a buffer state separating it from the U.S. military bases in South Korea. No matter what Putin says about nuclear proliferation, he wants North Korea to be militarily strong. So to the Russian military, the North Korean ballistic missile didn’t fall as close to Vladivostok as the White House said: It reported that the missile’s flight terminated 500 km from Russian territory.

Kim knows his regime’s continued existence depends on its credibility as a buffer. That makes any spontaneous act of aggression on North Korea’s part highly unlikely: It would bring war right to the borders of Russia and China, rendering Kim useless to the two powers. He needs to rattle his weapons just loud enough to deter the U.S. from acting and remain useful to North Korea’s bigger neighbors.

If that rattling is getting too loud for Washington, China isn’t the only partner with whom to discuss it. Its economic leverage isn’t so big in absolute terms that Russia couldn’t take over some or even most of the financial burden China carries today. Moscow has positioned itself as the next in line for a deal with Kim.

But then, talking to the Russians is almost more toxic for the current U.S. administration than talking to Kim himself. That makes it all but impossible to stop North Korea from running its increasingly ambitious tests and stepping up its threats to the U.S. Nor is military intervention a good option without both China’s and Russia’s consent: For both, a U.S. strike would be too close to home.

Threatening anyone who helps North Korea with sanctions, as Nikki Haley, the U.S. ambassador to the U.N, did this week, isn’t particularly effective: Western sanctions against Russia only made it more paranoid about the possibility of a Western attack and pushed it, among other things, to work closer with Kim.

Since 2014, Putin has tried to build a stock of things to sell to the U.S. in exchange for a free hand in the former Soviet Union, including Ukraine. He has leverage on the Syrian regime and the North Korean one, leverage in Iran and Libya. So far, he has found no takers. But avoiding a deal with him means trouble with his clients; unless the U.S. wants to risk using force in North Korea, it needs Putin’s cooperation in resolving the crisis.

Russian writer Leonid Bershidsky is a Bloomberg View columnist.