What has been agreed?
Under the new deal, Azerbaijan will hold onto areas of Nagorno-Karabakh that it has liberated from Armenian occupation during the conflict. Armenia has also agreed to withdraw from several other adjacent areas over the next few weeks.
During a televised online address, Azerbaijan's President Ilham Aliyev said that 1,960 Russian peacekeepers would be deployed to patrol frontlines. Turkey will also take part in the peacekeeping process, according to the President. President Aliyev said the agreement was of "historic importance," and amounted to a "capitulation" by Armenia.
President Putin said the agreement would include an exchange of war prisoners, with "all economical and transport contacts to be un-blocked."
Armenian PM Pashinyan said, his decision was based on "deep analyses of the combat situation and in discussion with best experts of the field". He called the deal "incredibly painful both for me and both for our people".
Internationally recognised Nagorno-Karabakh and 7 adjacent Azerbaijani territories were occupied by Armenia and has been run by ethnic Armenians since 1994. In that year, a truce was signed after fighting but not a peace deal. 3 ceasefire agreements have been brokered since fighting broke out again in September, but all of them have failed.
In the Armenian capital Yerevan, a large crowd has gathered to protest against the agreement, according to local media. They broke into government buildings, shouting "We will not give it up."
It is unclear exactly how many have died. Armenian authorities say nearly 1,200 of its defence forces have died in the fighting. Azerbaijan has not released its military casualty figures but has said more than 80 civilians have been killed in the fighting - including 21 in a missile strike on the town of Barda last month.
Russian President Vladimir Putin said last month that almost 5,000 people had been killed in the fighting.