Oil prices edged higher after two days of declines, as tensions over a possible Iranian attack on Israel overshadowed the first increase in U.S. crude inventories in seven weeks.

Brent crude traded near $80 a barrel after falling 3.1% in the previous two sessions, with WTI crude topping $77. Two weeks after Iran vowed to retaliate for the killing of a top Hamas leader on its soil, tensions are rising over what form the attack will take.

U.S. crude inventories rose by a surprise 1.36 million barrels last week, official data showed on Wednesday. The increase was notable given that a report from industry group the American Petroleum Institute a day earlier had indicated a large draw in inventories. Stockpiles remain below seasonal averages, but the data could add to concerns about weak demand.

Crude oil prices have fallen from recent highs in early July, weighed down by a bleak outlook for consumption in China, the world’s biggest oil importer, as demand for gasoline there slumps due to increased use of cleaner fuels. OPEC cut its 2024 global demand forecast this week, while International Energy Agency data showed the market would be in surplus next quarter if the group goes ahead with a plan to restore supplies.

On the other hand, the core inflation measure in the United States, which excludes food and energy costs, fell for a fourth month on an annual basis in July, keeping the Federal Reserve on track to cut interest rates next month.