The United Nations has welcomed a ceasefire announced between Armenia and Azerbaijan after two days of violence linked to a decades-old dispute between the former Soviet states over the territory of Nagorno-Karabakh.

The fighting, which each side blamed on the other, left more than 170 soldiers dead and threatened to drag Turkey, Azerbaijan's key backer, and Armenia ally Russia into a wider conflict at a time of already high geopolitical tensions.

A ceasefire was agreed between the two sides late yesterday after almost 48 hours of clashes, a senior Armenian official said.

Moscow, which has a self-defense pact with Armenia and a military base in the country but also strives for friendly relations with Azerbaijan, claimed credit for the deal.

UN Assistant Secretary-General Miroslav Jenca said: "The international community must remain fully committed to a peaceful settlement between Armenia and Azerbaijan and spare no effort to deescalate the current tensions."

Politico reported that US House of Representatives Speaker Nancy Pelosi would travel to Armenia this weekend in a show of support, and will be accompanied by US Representative Jackie Speier, who is of Armenian descent.

"We do not confirm or deny international travel in advance due to longstanding security protocols," Ms Pelosi's office said.

Before the ceasefire was announced, Armenia's prime minister, Nikol Pashinyan, said Azerbaijani forces had struck and seized several Armenian settlements along their shared border, in territory beyond the disputed Nagorno-Karabakh region. Baku said it was responding to "provocations" by the Armenian side.

Russia said today that it was seeking to reverse any shift in the military balance of the region that had occurred as a result of the fighting.

"We are in close contact with both countries, so as to arrive at a sustainable ceasefire and the return of Azerbaijani and Armenian military to their positions of origin," Russia's ambassador to the UN, Vassily Nebenzia, told the 15-member Security Council.

Armenia's deputy defense minister told Reuters the conflict risked spilling over into a full-blown war, while some analysts said Baku was trying to take advantage of Russia's war in Ukraine to advance its position.

"This week's events are also a stark reminder that tensions between Armenia and Azerbaijan also have the potential to destabilise the region," the Mr Jenca said.

The fighting was the deadliest in almost two years, since a six-week war in 2020 left thousands dead and Azerbaijan made significant territorial gains in and around Nagorno-Karabakh.