MOSCOW — Russian peacekeeping forces were deployed to an ethnic Armenian territory in the Caucasus Mountains on Tuesday, cementing Azerbaijani gains in a brutal, six-week-long war that reordered the geopolitics of a volatile region.
There was jubilation in Baku, the capital of Azerbaijan, and sorrow and anger in Yerevan, the capital of Armenia. More than 1,300 soldiers had died on the Armenian side of the conflict alone since late September, when a quarter-century of tensions over the disputed area, Nagorno-Karabakh, exploded into open warfare.
Azerbaijan emerged largely successful in retaking territory that belonged to Baku under international law but had been de facto controlled by Armenia since the two countries’ previous war, in the early 1990s. Late Monday night, President Vladimir V. Putin of Russia announced that the two sides had agreed to stop the fighting in a deal that ceded more land to Azerbaijan but retained Armenian control over some of the territory, including the capital, Nagorno-Karabakh.
“We have once again proved that we have invincible soldiers, officers and generals who are ready to sacrifice their lives for the defense of our holy motherland without a second thought,” Armenia’s Defense Ministry said in a statement. “But it is time to stop the bloodshed.”
Russian television footage showed Russian troops driving toward Nagorno-Karabakh, underscoring Mr. Putin’s geopolitical win for brokering peace between two countries that used to be part of the Soviet Union. But behind the day’s drama lay the growing regional power of Turkey, which staunchly backed Azerbaijan in the conflict and also celebrated on Tuesday.
Mr. Putin has spoken with President Recep Tayyip Erdogan of Turkey at least four times since the start of the war on Sept. 27, most recently on Tuesday. Mevlut Cavusoglu, Turkey’s foreign minister, hailed the peace agreement as “a great success and victory for Azerbaijan.”
Under the agreement, some 1,960 armed Russian service members and 90 armored vehicles will deploy for at least five years to guard the line of contact between Armenian and Azerbaijani forces in the region and along the road connecting Armenian-controlled Nagorno-Karabakh to Armenia. Azerbaijan retained control of the hilltop town of Shusha, a place of historic and strategic significance to both countries, which it captured in recent days.
But there were many unknowns about the future of the region, including the peacekeepers’ precise role and how soon Azerbaijanis will resettle the recaptured areas. The early 1990s war displaced a million people, most of them Azerbaijanis, and pressure from those forced to flee their homes was among the factors pushing President Ilham Aliyev of Azerbaijan to retake the territory by force.
“This brings Baku what it long failed to attain through negotiation,” Zaur Shiriyev, the South Caucasus analyst for the International Crisis Group, said in a phone interview from the Azerbaijani capital.
Mr. Shiriyev said he was awakened just after 3 a.m. Tuesday by the din of celebrations in the streets. He said people waved the flags of Azerbaijan, Turkey and even Israel — a country that sold to Azerbaijan some of the high-tech drones that tilted the balance in Baku’s favor.
Yerevan, the capital of Armenia, also erupted, but with the yelling of demonstrators furious that Nikol Pashinyan, Armenia’s prime minister, had signed the agreement ceding Armenian land.
Bellowing “Where is Nikol? Where is that traitor?” some protesters stormed Mr. Pashinyan’s residence. They also broke into the Parliament and beat its speaker, Ararat Mirzoyan, who required surgery.
Opposition politicians called for Mr. Pashinyan’s resignation, and amid the tumult, Mr. Pashinyan posted on Facebook on Tuesday morning that he was in Armenia and continued to work as prime minister. The country’s leadership struggled to convince the public that it had no choice but to stop the fighting now, because Armenia had suffered steep losses of life and territory.
“I made this decision after the army kept insisting for a long time on the need to take such a step,” Mr. Pashinyan said in a live broadcast on Facebook Tuesday, according to Russia’s Interfax news agency. “The army said that it is necessary to stop, that there are certain problems and they either do not see the prospects to solve them or the resources for their resolution have been exhausted.”
There was also pain: The lush mountains of Nagorno-Karabakh, known to Armenians as Artsakh, had long been part of a national and ethnic identity for Armenians around the world. The loss of that territory on Tuesday was already taking a place in the annals of tragedy in Armenian history, alongside the slaughter and expulsion of Armenians from Turkey a century ago in what most neutral historians call the century’s first genocide.
“The trauma of victimization has returned,” said Richard Giragosian, director of the Regional Studies Center in Yerevan. “There’s a sense that the world and the West have abandoned us.”
Azerbaijan launched an offensive on Sept. 27 to retake Nagorno-Karabakh and surrounding, previously Azerbaijani-populated regions, which are all part of Azerbaijan under international law but have been controlled by Armenia since the 1990s war. Azerbaijan lost the war a quarter-century ago, but in recent weeks, Azerbaijan’s firepower has proved superior, with the country’s oil wealth funding a fleet of drones and other modern weaponry.
Tatul Hakobyan, an Armenian journalist who has covered the region for more than 30 years, said small-arms fire was audible from the capital of Nagorno-Karabakh, Stepanakert, on Sunday, indicating that Azerbaijani forces were closing in. The mounting losses appeared to pressure Armenia into accepting Azerbaijan’s territorial gains in order to stop the fighting.
“We lost the war, and this is the tragic reality which we should accept,” Mr. Hakobyan said in a telephone interview.
Armenia’s Defense Ministry said Tuesday morning that combat operations along the front line had been suspended and that Russian peacekeepers were being deployed. In Azerbaijan, Mr. Aliyev described the agreement as one of his country’s greatest triumphs.
“We are proud of our people, of our Armed Forces!” Mr. Aliyev said in a Twitter posting on Tuesday. “For our people, these days are the happiest ones.”
The end of the war suggests a sweeping redrawing of the security map of the southern Caucasus, a volatile region wedged between Turkey, Russia and Iran. The settlement sealed a role in the region for an increasingly assertive Turkey.
Russia’s leading role in stopping the fighting also shows that Moscow continues to be the most influential player in the southern Caucasus. Some Armenians had hoped for a more forceful Russian role in the war, since the two countries have a mutual-defense treaty.
But according to Mr. Hakobyan, the Armenian journalist, it was Russia’s decision to send peacekeepers that spared Armenians from having more of Nagorno-Karabakh — including Stepanakert — fall under Azerbaijani control.
“Smart and sober Armenians understand that the Russians intervened and in a way saved Karabakh proper,” Mr. Hakobyan said.
“We proceed from the assumption that the agreements reached will create the necessary conditions for a lasting and full-scale settlement of the crisis over Nagorno-Karabakh on a fair basis and in the interests of the people of Armenia and Azerbaijan,” President Vladimir V. Putin of Russia, who brokered the agreement between Mr. Pashinyan and President Ilham Aliyev of Azerbaijan, said in a statement overnight.