(Bloomberg) -- President Joe Biden said Americans will have to endure high gas prices “as long as it takes” to beat back Russian President Vladimir Putin’s invasion of Ukraine. 

“As long as it takes, so Russia cannot in fact defeat Ukraine and move beyond Ukraine,” Biden told reporters Thursday in Madrid, in response to a question about how long high gas prices might persist.  

The national average gasoline price hit a record this month above $5 a gallon, even after Biden ordered a historic release from US reserves earlier this year. Prices at the pump have been a main driver of inflation, which has been a major political headache for the Biden administration. 

Americans have cited inflation -- which hit a four-decade high this spring -- as their primary concern heading into the November midterms. 

Biden has repeatedly said a recession is not inevitable, even as concerns grow a downturn is on the horizon. 

Read more: Powell Says Fed Can Avert Recession But Task Getting Tougher

An Associated Press-NORC Center for Public Affairs Research  poll released Wednesday found that 85% of adults said the country was on the wrong track, with 79% describing the economy as “poor.” In that same poll, 67% of Democrats deemed economic conditions as bad.

The Biden White House has taken pains to show it is trying to solve the inflation quandary -- by tackling supply chain snarls, releasing extra barrels of oil from the strategic petroleum reserve and lifting the ban of E15 gas during the summer. 

Biden aides have tried to point to the strong labor market and low unemployment rate as the major bright spot of the economy -- and evidence of their strong stewardship of the U.S. during Covid.

©2022 Bloomberg L.P.