Armenia, Azerbaijan and Russia have signed an agreement to end military conflict over the disputed enclave of Nagorno-Karabakh.
The peace deal takes effect on Tuesday from 01:00 local time (21:00 GMT Monday).
It comes after six weeks of fighting between Azerbaijan and ethnic Armenians.
The region is internationally recognised as Azerbaijani, but has been run by ethnic Armenians since 1994.
That year, a truce was signed but no peace deal.
Since fighting began again in September, a number of ceasefire agreements brokered during the conflict have all failed.
The Armenians have steadily lost territory and over the weekend Azeri forces took over the region’s second largest town Shusha, known as Shushi in Armenian.
Azerbaijan has also admitted to mistakenly shooting down a Russian military helicopter over Armenia, killing two crew members and injuring a third.
Under the new agreement, Azerbaijan will hold onto areas of Nagorno-Karabakh that it has taken during the conflict.
Armenia has also agreed to withdraw from several other adjacent areas over the next few weeks.
During a televised online address, Russia’s President Vladimir Putin said that Russian peacekeepers would be deployed to patrol frontlines.
There would also be an exchange of prisoners of war, and an unblocking of all economic and transport links.
Azeri President Ilham Aliyev, who joined President Putin, called the deal “a [crucial] point in the settlement of the conflict,” according to Reuters news agency.
But in a post on social media, Armenian Prime Minister Pashinyan said the agreement was “incredibly painful both for me and both for our people”.
He added that his decision was based on “deep analyses of the combat situation and in discussion with best experts of the field”.
“This is not a victory but there is not defeat until you consider yourself defeated,” the prime minister said.