Officials said President Biden had struggled for days over the move amid deep concerns about accelerating the already rapid rise in the price of gasoline.WASHINGTON — President Biden on Tuesday banned imports of Russian oil, gas and coal in response to what he called President Vladimir V. Putin’s “vicious war of choice” in Ukraine, but warned Americans that the decision to inflict economic pain on Russia would inevitably mean higher gas prices at home.“Defending freedom is going to cost,” Mr. Biden said in televised remarks announcing the ban at the White House.The president’s move immediately shut off a relatively small flow of oil into the United States, but it was quickly followed by a British pledge to phase out imports of Russian oil by the end of the year and a declaration from the European Commission — the executive arm of the European Union, which is heavily dependent on Russian oil and gas — to make itself independent of that supply in the coming years.The impact of the decisions quickly rippled across the global energy market amid fears that the supply of oil would shrink. In the United States, the national average price of a gallon of regular gasoline, which had already surged in recent weeks, reached $4.173, not adjusted for inflation, a new high and an average increase of about 72 cents from only a month ago, according to AAA.“If we do not respond to Putin’s assault on global peace and stability today, the cost of freedom and to the American people will be even greater tomorrow,” Mr. Biden said.He vowed to “do everything I can to minimize Putin’s price hike here at home.”Under intense, bipartisan pressure from lawmakers to deny Russia any more oil revenue from Americans, Mr. Biden acted without the unity among allies that has characterized most of the response to Russia’s aggression during the past several months.The moves by Britain and the E.U. fell short of Mr. Biden’s ban. Franck Riester, the French minister for foreign trade, told the Franceinfo radio station on Monday that “everything’s on the table,” but that officials would need to consider “consequences” from an energy ban. In Italy, which imports more than 40 percent of its energy as Russian gas, Prime Minister Mario Draghi has said the overdependence on Russian gas is a strategic weakness for the country.Even as Mr. Biden spoke, describing his ban as “another powerful blow to Putin’s war machine,” a new wave of major corporations across the world began shutting down their operations in Russia on Tuesday.Shell, Europe’s largest oil company, said it would begin withdrawing from its involvement “in all Russian hydrocarbons,” including an immediate halt to all spot purchases of Russian crude and the shuttering of its service stations in the country. McDonald’s, Coca-Cola, Pepsico and Starbucks announced that they would temporarily close all restaurants and pause all operations in Russia in response to the invasion in Ukraine. Amazon stopped letting customers in Russia and Belarus open new cloud computing accounts.An oil refinery in Omsk, Russia. About 12 percent of the world’s oil and 17 percent of its natural gas comes from Russia, according to estimates from J.P. Morgan.Alexey Malgavko/ReutersOfficials said Mr. Biden had struggled for days over whether to cut off Russian oil amid fears of accelerating the already rapid rise in the price of gasoline. It is a potent political issue for Americans in an election year and a test of how much voters are willing to sacrifice in defense of Ukraine.Even into the weekend, as a bipartisan group of lawmakers in the House tried to finalize legislation to impose a ban on Russian oil, the White House expressed deep concerns, according to officials monitoring the discussions, who said the administration appeared wary of letting Congress take the lead on enacting a ban.A vote on the House bill, which is supported by Speaker Nancy Pelosi of California, was delayed late Tuesday.The president and his aides have discussed a series of additional moves to blunt the impact of the ban, including additional releases from strategic oil reserves. Last week, the United States committed to releasing 30 million barrels of oil, joining 30 other nations for a total release of 60 million barrels.Administration officials have also held diplomatic conversations with other oil-producing nations, including Venezuela, about increasing the flow of oil to keep prices stable. Jen Psaki, the White House press secretary, on Monday confirmed discussions with Venezuela about “energy security” and other issues, but declined to elaborate.Any barrels the United States imports to replace Russian oil will come from a global market that is already stretched. Unless and until Russia finds alternative buyers, the constraint on available supplies is likely to keep prices high.U.S. consumers are already feeling the squeeze. In California, prices for some types of gas has hovered around $6 in recent days; on Tuesday the state average was well over $5.Republicans on Tuesday largely backed Mr. Biden’s decision to cut off Russian oil, giving the president a rare moment of bipartisan support. But even as they did so, many Republicans once again seized on high prices at the pump to criticize him and his party.“Democrats want to blame surging prices on Russia,” Representative Kevin McCarthy of California, the House Republican leader, said on Tuesday. “But the truth is, their out-of-touch policies are why we are here in the first place.”In his remarks, Mr. Biden cast the decision as a moral one, aimed at further crippling Mr. Putin’s economy as Russian forces continued their brutal bombardment of civilians in several of Ukraine’s cities and suburbs after two grueling weeks of war in Europe.“Ukrainian people have inspired the world and I mean that in the literal sense,” Mr. Biden said. “They’ve inspired the world with their bravery, their patriotism, their defiant determination to live free. Putin’s war has caused enormous suffering and needless loss of life of women, children, and everyone in Ukraine.”He added: “Putin seems determined to continue on his murderous path, no matter the cost.”Battles continued to rage across Ukraine on Tuesday as humanitarian officials reported that two million refugees have fled the country seeking safety. But casualties increased as evacuations though supposed “green corridors” continued to come under fire.About 2,000 civilians were able to escape Irpin, a suburb just northwest of Kyiv, Ukraine’s capital, which has spent days without water, power and heat because of the heavy fighting in the area. In the war-battered city of Sumy, east of Kyiv, one humanitarian corridor lasted long enough to allow hundreds of civilians to escape in a convoy of buses led by the Red Cross.Civilians were evacuated from Irpin, Ukraine on Tuesday.Lynsey Addario for The New York TimesBut hundreds of thousands of Ukrainians remain trapped in the besieged southern city of Mariupol.The Ukrainian military claimed to have shot down three Russian fighter jets and a cruise missile early Tuesday, an assertion that appeared to be backed up by several loud explosions over Kyiv, a potential sign that Ukraine’s air defense systems and air force are still functioning.President Volodymyr Zelensky of Ukraine taunted Mr. Putin on Tuesday with a video showing him in his office in Kyiv and saying: “I’m not hiding. And I’m not afraid of anyone.” Mr. Zelensky also spoke by video link to a packed meeting of Britain’s Parliament.The Pentagon on Tuesday rejected an offer by Poland to send its MiG-29 fighter planes to a U.S. air base in Germany to aid the Ukrainians, saying that for such jets to depart a U.S./NATO base “to fly into airspace that is contested with Russia over Ukraine raises serious concerns for the entire NATO alliance.”Separately, the Pentagon said it was sending two Patriot anti-missile batteries to Poland to protect U.S., Polish and other allied troops there, reflecting an increasing fear in Warsaw and in Washington that Russian missiles fired in neighboring Ukraine could end up in Poland, whether on purpose or by accident.White House officials said the president signed an executive order on Tuesday that prohibits anyone in the United States from importing “Russian crude oil and certain petroleum products, liquefied natural gas and coal.” It also bans new U.S. investment directly in Russia’s energy sector or in foreign companies that are investing in energy production in Russia, officials said.In announcing his decision, Mr. Biden acknowledged that some European countries, including Germany and France, would most likely not follow suit because they rely much more heavily on energy from Russia.“A united response to Putin’s aggression has been my overriding focus to keep all of NATO and all of the E.U. and our allies totally united,” Mr. Biden said. “We’re moving forward with this ban understanding that many of our European allies and partners may not be in a position to join us.”Russia-Ukraine War: Key Things to KnowCard 1 of 4Russian oil imports. More