LONDON - Copper prices slipped from their highest in over three weeks on Tuesday, pressured by a firm dollar and worries about a potential recession sparked by interest rate hikes to fight inflation.

Copper has recently been caught between bullish and bearish influences and prices earlier advanced on investor hopes that lifting China's lockdown restrictions will boost demand.

Three-month copper on the London Metal Exchange dropped 0.4% to $9,505 a tonne in official open-outcry trading, after earlier climbing to its highest since May 5 at $9,591.50.

U.S. Comex copper gained 0.7% to $4.34 a lb by 1220 GMT.

Shanghai authorities removed lockdown fences on Tuesday, preparing to lift a two-month lockdown at midnight, while China's cabinet announced a package of 33 stimulus measures to revive its pandemic-ravaged economy.

"The news from China is just enough to create a refocus in the market towards a possibility of a pick up in demand," said Ole Hansen, head of commodity strategy at Saxo Bank in Copenhagen.

"There's a slowdown coming, but the question is whether it will be to the extent that it will have a negative impact on global demand," Hansen added.

A surge in oil prices fanned fears of further acceleration in global inflation that would keep the U.S. Federal Reserve and other central banks raising interest rates.

Copper slid 18% during about two months after touching a record high of $10,845 a tonne in early March on fears about a slowdown in China and inflation disrupting economies elsewhere.

In May, LME copper is on track for its second monthly decline with a drop of 2.5%.

But weak metals inventory levels were a sign of underlying strength in the market, Hansen added.

"It's quite telling that despite worries about growth and demand there hasn't been a pick-up of inventory levels at a time of year when you would expect some stock build."

* Data showed China's factory activity contracted at a slower pace in May, as restrictions on some plants were lifted.

* The dollar rose against its rivals, making greenback-denominated metals more expensive for buyers using other currencies.

* LME tin edged down 0.03% to $34,575 a tonne and was set to tumble 14% in May, its worst monthly performance since 2011.

* LME aluminium shed 1.4% in official activity to $2,848 a tonne and nickel dropped 1.8% to $28,750, but zinc rose 1.3% to $3,950 and lead added 0.1% to $2,177.

(Additional reporting by Brijesh Patel in Bengaluru; Editing by Kirsten Donovan)