LONDON (AP) — Inflation in the United Kingdom slowed slightly last month as a drop in gasoline and diesel fuel prices gave consumers the first glimmer of hope that Britain’s cost-of-living crisis may be beginning to ease.

The consumer price index rose 9.9% in the 12 months through August, the Office for National Statistics said Wednesday. That’s down from the 40-year high of 10.1% reported last month and was lower than economists’ expectations of 10%.

Britain has been hard hit by worldwide price shocks triggered by the war in Ukraine, with consumer prices rising at a faster pace than other major economies over the past year. Lower gasoline costs also slowed U.S. inflation for a second straight month in August, but consumer prices that jumped 8.3% from a year earlier were still painfully high — much like in the U.K.

British Prime Minister Liz Truss last week moved to ease the pain, announcing a cap on household gas and electricity prices to head off an 80% increase in home energy costs this winter. Before that announcement, the Bank of England had estimated that inflation would peak at 13.1% later this year and trigger a recession.

“The headline rate of CPI inflation fell in August for the first time since last September and now looks set to drop sharply next year, thanks partly to the government’s energy price cap,” said Samuel Tombs, chief U.K. economist for Pantheon Macroeconomics.

Tombs estimates that the inflation rate will now peak at around 11% next month and may drop to the Bank of England’s 2% target by the end of next year. The bank postponed its upcoming meeting until next week to honor the mourning period for Queen Elizabeth II, and it’s expected to carry out another interest rate hike to tame inflation like other central banks around the world.

Gasoline prices fell 7.5%, to 175.2 pence ($2.01) a liter, in August as oil prices dropped on international markets, the statistics office said. While the decline brought welcome relief to drivers, the cost of fuel is still 32% higher than it was a year ago.

Similarly, in the U.S., the average cost of a gallon of gasoline has dropped to $3.71, down from just above $5 in mid-June.

But there was no relief on other energy costs in the U.K. Electricity prices rose 54% in the period, and natural gas prices rose almost 96%.

At the grocery store, a jump in the cost of milk, cheese and eggs drove food prices up 13.1% in the year through August, the statistics office said.