British energy giant BP suffered a billion-dollar loss in the first quarter despite a jump in sales due to rising oil and gas prices.

The group posted a sharp minus of 20.4 billion dollars (around 19.4 billion euros), as BP announced on Tuesday.

The reason for this is that BP sold its stake in the Russian Rosneft group because of the Russian attack on Ukraine.

BP held almost 20 percent of the Russian oil company and announced at the end of February that it would divest itself of its stake in Rosneft.

Write-downs of up to $25 billion could result, BP said at the time.

The group booked a pre-tax charge of $25.5 billion as a result of the break with Rosneft, according to Tuesday's information.

The decision led to "significant" non-cash charges, said CEO Bernard Looney.

In the first quarter of 2021, BP had posted net income of $4.7 billion.

Higher prices

The losses related to the Russian exit also outweighed the benefit to BP from rising energy prices.

Revenue for BP increased 40 percent year over year to $51 billion in the first quarter.

Looney said the quarter was "marked by the tragic events in Ukraine and volatility in energy markets."

BP has focused on "delivering our customers the reliable energy they need".

Despite the massive loss in the first quarter, BP shares initially rose on Tuesday and rose by around two percent in the morning.