Over the last few weeks, a Russian blitz has claimed more than a dozen villages in northeast Ukraine, near the country’s second-largest city. This summer, Russia will likely continue its offensive push in the country’s east.

Russia’s ability to carry out these attacks is in some ways surprising. War is expensive. And Russia’s economy is limited by steep sanctions from some of the richest countries in the world. Yet Moscow has managed to keep paying for its war machine.

How? U.S. officials point to China.

China has vowed not to send weapons to Russia. But it has supported Russia’s economy by buying oil and expanding other kinds of trade. Russia uses the revenue from that trade to manufacture weapons. It has also bought parts for these weapons from China, according to U.S. officials: Last year, Russia got 90 percent of its microelectronic imports from China, using them for missiles, tanks and planes. Without Beijing’s help, Moscow might still continue its war, but it would do so in a weakened state.

Of course, Washington and its allies have also provided support, including actual weapons, to Ukraine. From that angle, the war looks more like part of the broader contest between the U.S. and China — what some analysts call a new cold war — than a one-off conflict. “We are headed into 30 or 40 years of superpower competition and confrontation,” said my colleague David Sanger, who covers national security and recently published the book “New Cold Wars.” Ukraine is just the current front.

Today’s newsletter will explain what China stands to gain — and lose — by backing Russia.

Support for Russia is risky. The U.S. and Europe have warned that they could place sanctions on China if it supports the war. But to China, the benefits of a Russian victory in Ukraine may outweigh the costs.

Among those benefits: The war has entangled the U.S. and its allies in a faraway conflict, straining the U.S. military’s ammunition stockpiles. It has made Russia, a big military power, more dependent on China. It has also been instructive: China has ambitions to invade Taiwan, and it has watched Russia’s gamble to see the world’s response — one that has exposed the limits of America’s reach. While Washington got its closest allies to punish Russia for the invasion, big democracies such as Brazil and India continue to buy Russian oil.