WASHINGTON — When Ukrainian President Volo-dymyr Zelensky arrived at the White House on Wednesday, he became just the second European head of state to sit with President Biden in the Oval Office. It was a clear signal of the importance Biden places on protecting Ukraine in the 30-year-old democracy’s ongoing war with Russia.

“The U.S. remains firm in its commitment to Ukraine’s sovereignty and territorial integrity in the face of Russian aggression and — and our support for Ukraine’s Euro-Atlantic aspirations,” Biden said at the outset of the discussion, touting new agreements to broaden cooperation on defense, energy and economic development.

But the meeting, which was pushed back two days as Biden focused on the final withdrawal of U.S. forces from Afghanistan and the impact of a major hurricane, came at a moment when evidence of America’s inward turn and its shrinking influence around the world is unavoidable.

In remarks Tuesday marking the end of 20 years of conflict in Afghanistan, Biden espoused something of a foreign policy doctrine, stating that the “fundamental obligation of a president ... is to defend and protect America, not against the threats of 2001 but the threats of 2021 and tomorrow.” He suggested that the $2.3-trillion U.S. investment in the Central Asian country cost the United States countless “opportunities” and “was no longer in the vital national interests of our people.”

For all of Biden’s impassioned rhetoric about the importance of democracies prevailing over autocracies, his desire to reassert American leadership around the world has been tempered by an acceptance of geopolitical realities and a determination to reduce America’s military footprint abroad while focusing on an economic recovery program at home.

He is also seeking to pivot U.S. foreign policy from the quagmire of the Middle East and Afghanistan to confront the rising threat of a new world power in Beijing. Those changes in focus, experts say, have frustrated long-standing allies and could complicate Zelensky’s efforts to build deeper ties with Washington.

“The reality of the Biden administration is more unilateralism, and more domestic focus than a lot of allies had expected,” said Ian Bremmer, president of the Eurasia Group, a global risk assessment firm.

Zelensky, a former comedian, is already something of a household name in Washington, having played involuntary roles in then-President Trump’s first impeachment trial and in the 2020 election campaign. He was the rather bewildered recipient of the infamous telephone call in which Trump threatened to cut off military aid to Ukraine unless Zelensky dug up dirt on Biden, a Democratic rival who as vice president led U.S. efforts to push Ukraine to clean up corruption.

The Ukrainian president arrived in Washington this week — the second European leader to visit the White House after German Chancellor Angela Merkel in July — eager to win commitments from Biden for economic and military support in his country’s ongoing conflict with Russia. Moscow has occupied part of Ukraine’s territory, the Crimean peninsula, since 2014 and is backing separatists fighting in an eastern region of the country.

Zelensky, briefly addressing reporters in the Oval Office at the outset of a roughly two-hour meeting, offered Biden his condolences for the 13 service members killed last week in a suicide bombing attack outside the airport in Kabul, the Afghan capital. He also expressed his eagerness to discuss Ukraine’s aspirations to join the North Atlantic Treaty Organization, a move that would require the alliance to involve itself more directly in fending off Russia’s advances.

Although Biden’s presidency has brought relief from Trump’s pressure tactics, his administration has frustrated Kyiv. Ukrainian officials are most upset about Biden’s recent decision to not sanction Germany and others in Europe for their role in constructing a Russian pipeline that will transport Russian gas to Germany.

This was widely seen as a boon for Moscow, as Europe increases its reliance on Russian gas, and a slap at smaller countries such as Ukraine that stand to lose out on energy revenue. Biden said that although he disliked the pipeline project, Nord Stream 2, it was already 95% completed when he took office and it would be better to monitor and restrict it than to punish Germany, with which he wanted to repair ties damaged under Trump.

“They feel like the administration crossed them on this and owes them,” said John Herbst, a former U.S. ambassador to Ukraine who now leads the Eurasia Center at the Atlantic Council, a nonpartisan think tank in Washington.

Republicans, who have thus far blocked Biden’s diplomatic nominees over his refusal to impose sanctions to stop the pipeline, took up Zelensky’s cause.

Rep. Michael McCaul of Texas, the ranking Republican on the House Armed Services Committee, urged Biden to “reverse course” on what he called the “recent betrayal of Ukraine.” He likened the president’s reluctance to take a stronger stance with Russian President Vladimir Putin to his determination to stick to his Aug. 31 Afghanistan withdrawal deadline, which McCaul said was to avoid antagonizing the Taliban.

“President Biden has rolled over to our adversaries too many times,” McCaul said in a statement.

Although Biden reiterated his opposition to the pipeline in a joint communique after his meeting with Zelensky, he did not change his position on sanctions. Instead, he outlined a promise to engage diplomatically “to maintain Ukraine’s transit role and security of supply during this period of energy transition and to prevent the Kremlin’s use of energy as a geopolitical weapon.”

The White House also has asserted that Biden has given Zelensky and Ukraine what one senior administration official said was “as much, if not more, attention ... than any other European country.” And although President Obama opted to not respond militarily to Putin after Russia’s 2014 annexation of Crimea, Washington has provided $2.5 billion in aid to Ukraine in the seven years since.

In another sign of the U.S. commitment to Ukraine, Biden signed off on new agreements that will include an additional $60 million in U.S. security aid, which comes on top of a $150-million aid package for Ukraine authorized in June, and a pledge to boost trade. The new security aid includes Javelin anti-armor systems and other defensive lethal and nonlethal capabilities, the White House said.

The Pentagon also agreed to a revised strategic defense framework to boost cooperation on matters such as Black Sea security, cybersecurity and intelligence sharing and continued military support in the face of Moscow’s show of force. Russia massed troops along its border with Ukraine in May and has scheduled military exercises in the area next month.

On the economic front, Biden and Zelensky finalized an agreement on commercial cooperation with $3 billion in support from the Export-Import Bank of the United States.

Much of the aid to Ukraine, from the U.S. and European allies, has been conditioned on reforms that Zelensky has agreed to implement to fight corruption and improve the national judiciary. Though Zelensky got off to a good start after taking office in May 2019, the last couple of years have been disappointing, said Herbst, the former U.S. ambassador. Zelensky is pushing legislation that aims to improve Ukraine’s national security agency and has recently fired two judges, appointed by his predecessor, who had sought to nullify his government’s fight against corruption.

“It’s been a mixed picture, and not one that would justify a major new commitment in economic aid,” Herbst said.