BP has reported its best first-quarter profit in more than a decade, driven by high oil and gas prices as well as strong refining margins, despite a larger write down on assets in Russia.

The energy giant’s underlying replacement cost profit, used as a proxy for net profit, stood at $6.2bn for Q1 2022, up from $2.6bn a year ago.

For the first quarter, ended 31 March, BP reported a loss attributable to shareholders of $20.4bn, as against a profit of $4.66bn for the Q1 2021. This included a $25.5bn write-down from exiting Russia.

BP CEO Bernard Looney said: “In a quarter dominated by the tragic events in Ukraine and volatility in energy markets, bp’s focus has been on supplying the reliable energy our customers need. Our decision in February to exit our shareholding in Rosneft resulted in the material non-cash charges and headline loss we reported today.

“But it has not changed our strategy, our financial frame, or our expectations for shareholder distributions. Importantly bp continues to perform and step-by-step we are making progress executing our IEC strategy – producing resilient hydrocarbons to provide energy security while investing with discipline in the energy transition.”

Furthermore, the company reduced its net debt to $27.5bn during the quarter, while surplus cash flow was more than $4bn, an increase from $1.68bn in the same quarter of last year.

BP also announced plans to increase its quarterly share buybacks to $2.5bn before the end of Q2 2022.

In a separate development, BP unveiled its plan to invest up to $22.5bn (£18bn) in the UK energy system to help boost energy security and achieve net-zero emissions targets.

As part of the plan, the firm will invest in lower emission oil and gas projects in the North Sea to support near term supply security.