MOSCOW — The party of Armenia’s prime minister, Nikol Pashinyan, won a snap election over the weekend that also signaled at least grudging acceptance by Armenians of a peace settlement negotiated last fall with Azerbaijan.

Forced on Armenia by battlefield losses and negotiated by Mr. Pashinyan, the settlement remains deeply unpopular. It ended a six-week war over the enclave of Nagorno-Karabakh, an ethnic-Armenian area inside Azerbaijan, but at a steep cost for the Armenian side. The deal ceded territory that included centuries-old monasteries that are a touchstone for Armenian national identity.

In the immediate wake of the deal in November, nationalist protesters stormed Mr. Pashinyan’s office and tore his nameplate from the door. It seemed unclear whether he could remain in power to enforce the tentative peace in the South Caucasus, a region where Turkey and Russia compete for influence.

But the election results announced on Monday showed Armenian voters apparently willing to accept Mr. Pashinyan’s agreement, and with it a cleareyed view of their country’s difficult security challenges.

Election officials said Mr. Pashinyan’s party, Civil Contract, had won 53.9 percent of the vote. Mr. Pashinyan celebrated the win as a “mandate of steel” from voters. In a video address, he said it would “restore social and national consolidation” after the war.

A bloc of parties headed by a former president, Robert Kocharyan, came in second with 21 percent of the vote. Mr. Kocharyan said on Monday that the results were tainted by fraud.

Mr. Kocharyan and other opposition candidates had criticized the peace settlement and suggested they might renegotiate the Russian-brokered deal through more forceful diplomacy.

But this line of criticism, based largely on wishful thinking that Azerbaijan, Turkey and Russia might accept changes, failed to resonate with voters, said Richard Giragosian, director of the Regional Studies Center, a research group in Yerevan.

Mr. Kocharyan and other opposition candidates had not suggested abrogating the agreement and did not directly criticize Russia’s role in the negotiations or the deployment of peacekeeping troops to Nagorno-Karabakh.

The reluctance to criticize Russia’s role also highlighted Moscow’s growing sway in Armenian politics. No candidates ran in open opposition to Russia’s military presence in the region.

“The net outcome of the war for Armenia means that Armenia is in the Russian orbit ever more firmly,” Mr. Giragosian said. “Armenian politicians across the board are pro-Russian.”

Other factors in Armenian politics also helped Mr. Pashinyan: The opposition was divided by infighting and Mr. Pashinyan’s domestic policies of fighting corruption and focusing on road building and rural development remain popular, opinion polls have shown. The surveys suggested Armenians were more focused on economic issues than on the lost territories.

In the fighting last fall, Azerbaijan captured districts it had lost in a conflict during the breakup of the Soviet Union three decades ago. Turkey’s role was pivotal, supplying drones and other assistance, and tipping the scales against Armenia.

Turkish intervention also stirred worry of a wider war in the South Caucasus region that might draw in Turkey and Russia, because Moscow has a defense pact with Armenia.

The settlement ended the fighting but also brought a greater Russian military presence to the South Caucasus, a region of mountains and multiple ethnic groups that has been an intersection of Turkish and Russian influence for centuries. It left Russian peacekeepers in de facto control of Nagorno-Karabakh, facing Azerbaijan’s Turkish-backed troops over a shaky line of control where the fighting ended.