In promising Ukraine billions of dollars in long-term military aid, the Biden administration is seeking to prove that U.S. support in the war can outlast Russia’s determination.

Rallying American lawmakers and the public around that assistance, and billions in more immediate help, has been relatively painless for President Biden. But he must also keep Europe on board as the Russian invasion has sent energy prices soaring and created what could become the continent’s worst economic crisis in a generation.

American officials insist they have not seen any cracks in the NATO alliance, whose members, to varying degrees, have agreed to back Ukraine in the defense of its homeland. Ukraine’s recent battlefield successes, from routing Russian troops in the northeast to isolating Russian units in the south, will also help shore up resolve in Europe, American officials say.

But the jump in energy prices in Europe, and the prospect of frigid homes in the looming cold months, has led to anxiety. Russia heightened those concerns by recently announcing that Gazprom, the state-owned energy company, would not resume the flow of natural gas to Europe through its Nord Stream 1 pipeline.

President Vladimir V. Putin of Russia, military and diplomatic analysts say, believes that a gas shortage will weaken European support for Ukraine.

Secretary of State Antony J. Blinken said Russia had “weaponized energy” against the Europeans.

“President Putin is betting that these actions will break the will of countries to stand with Ukraine,” he said at NATO headquarters in Belgium earlier this month. “He’s betting that the Kremlin can bully other countries into submission.”

Mr. Blinken’s visit to NATO, and to Kyiv, Ukraine’s capital, came just as Ukrainian forces were beginning to make significant gains across the northeastern part of their country.

Pentagon officials say a decree that Mr. Putin signed last month raising the target number of his country’s active-duty service members by about 137,000, to 1.15 million, was another sign that he believed Russia could still win a war of attrition.

“He is signaling that he’s trying to ground this thing out,” a senior defense official said in an interview. He spoke on the condition of anonymity because he was not authorized to speak publicly.