Russian peacekeepers will be deployed to the region as part of the agreement, reached by Azerbaijan’s President Ilham Aliyev, Armenian Prime Minister Nikol Pashinyan and Russian President Vladimir Putin, according to the news agency TASS.
Speaking on television after the statement was released, Putin said they believed it would create the “necessary conditions for a long-term and full-fledged settlement of the crisis around Nagorno-Karabakh on a fair basis.”
More than 1,000 people have been killed and tens of thousands more displaced in the conflict, which flared up in September. It is the deadliest bout of fighting since the two countries fought a war over the region in the late 1980s and early 1990s.
Despite being largely controlled by Christian Armenian troops for more than a quarter of a century, Nagorno-Karabakh is considered by the United Nations to be part of predominantly Muslim Azerbaijan.
Tuesday’s truce, which comes after the failure of three previous ceasefire attempts, was due to come into effect at 1 am (2100 GMT on Monday).
Under the terms of the deal, Azerbaijan will retain control of the strategically important town of Shusha – known as Shushi in Armenian – which it seized at the weekend and the Armenians will also cede control of several other districts.
Putin said that the two sides were already engaged in the exchange of prisoners of war and bodies, and that refugees would return to the region under the care of the United Nations High Commissioner for Refugees.
Television in Azerbaijan showed Putin and Aliyev signing the deal without Pashinyan, who was supposed to be there. In a televised address, Aliyev claimed Pashinyan had not in fact signed the agreement, adding “but he will have to.”
He also said the deal represented the “effective capitulation of Armenia.”
Demonstrators protesting against the announcement in the Armenian capital Yerevan broke through a cordon and stormed into the main government building, according to TASS.
Videos posted on social media showed them breaking windows, doors and furniture, and some even made it as far as Pashinyan’s office.
Other reports said demonstrators were heading to Pashinyan’s residence calling him a traitor, while some were heading to the presidential palace to demand power be handed to the army.
In a Facebook post, Pashinyan, whose whereabouts were unclear, said the decision to sign the agreement had been “very hard” and “inexpressibly sensitive for me personally and for our people.”
“I made the decision after a deep analysis of the military situation and the assessment by people who know it better than anyone,” he added.
Arayik Harutyunyan, regional leader of Nagorno-Karabakh, also defended the agreement.
“Having taken into account the difficult situation and the need to avoid further human losses and the total loss of Nagorno-Karabakh, I gave my consent to end the war,” the 46-year-old wrote on Facebook.
Aliyev said Turkish peacekeeping troops would be deployed in addition to those sent by Russia.
The 1,960 soldiers sent by Russia were to remain for five years, with the option of extending the deployment for another five years, he said without giving further details on the Turkish troops, whose deployment was not mentioned by Putin.
Russia has a permanent military presence in Armenia under a post-Soviet alliance but also has robust ties with Azerbaijan and Turkey.