MOSCOW — Ten days of demonstrations that escalated throughout Armenia forced the resignation Monday of the man who has led the country for the past decade, creating the latest crisis in a post-Soviet state trying to overcome a legacy of weak democratic rule.

The unexpected resignation prompted scenes of jubilation in the capital, Yerevan, and other cities. Tens of thousands of people flocked to the central Republic Square in Yerevan, where all afternoon and into the night they danced, cheered and waved the Armenian flag, a striped tricolor of red, blue and orange.

Serzh Sargsyan, president since 2008, reached his legal two-term limit earlier this month. A constitutional referendum in 2015 had transferred most presidential powers to the role of prime minister, however, and the Parliament, dominated by his right-wing Republican Party, swiftly voted him into the post with no other candidate given a chance.

“I was wrong,” Mr. Sargsyan said in a brief resignation statement carried by the official news agency. “The street movement is against my tenure. I am fulfilling your demand.”