MOSCOW — Two worlds collided in central Moscow on Sunday.

One was organized by the government of Vladimir Putin; the other opposed the Russian president.

Both filled the streets with youths, whether they were dancing in leotards or climbing lampposts in anger.

All this unfolded against the backdrop of Moscow’s 871st birthday, on a day when regional elections were held across the country, including for the capital’s mayor.

As Muscovites went out to vote, or take a stroll through the dolled-up city, thousands of supporters of jailed opposition leader Alexei Navalny protested Putin’s unpopular plans to raise the pension age.

The result was bizarre and somewhat surreal. Children had their pictures taken besides people in period costumes, while columns of riot police assembled just yards away.

Performers pranced about Moscow’s main thoroughfare, which was pedestrianized for the day’s festivities, as the din of crowds chanting “Putin is a thief!” and “Down with the czar!” floated above the classical music.

The clashes left some frustrated and confused. Svetlana, a 36-year-old accountant who gave only her first name, stood between protesters and a group of dancers dressed as enormous fluorescent flowers. “How am I meant to enjoy this day with all these police?” Others found themselves drawn to the protests by chance. Alexander, who also gave only his first name, was there with his two young sons, who were licking ice creams and clambering over a bench. “There are a million things the government could have done to fix the economy, but they chose to punish the people,” he said.

Hit by Western sanctions over election interference and Moscow's role in the crises in Syria and Ukraine, Russia’s economy is struggling. Over recent years, the Kremlin has sought to improve the quality of life in Moscow in exchange for allowing Putin to run the country as he likes.

Moscow authorities spent over $6 million on the anniversary holiday this weekend, Russian media reported, with $1.5 million going toward cloud-dispersing technology that ensured the capital was drenched in sunlight.

Protests were organized in 90 cities across the country, and Moscow’s turnout — which authorities put at 2,000 — was by far the highest. As is now routine at anti-Putin rallies, police were quick to respond, violently dispersing the crowds. Security forces were particularly heavy-handed in St. Petersburg, where they beat young people with batons, causing several to lose consciousness.

Almost 840 people were detained across Russia, according to OVD-Info, a nongovernmental rights monitoring group. Navalny, who was sentenced last month to 30 days in jail, said his arrest was designed to derail the protests.

Moscow Mayor Sergei Sobyanin, Putin’s former chief of staff, is widely expected to be reelected Sunday. Nevertheless, at the request of Russian authorities, Google removed Navalny’s calls for protest from YouTube ahead of the vote. Navalny’s aides said the tech giant had caved to censorship and had acted illegally.

Natalia Abbakumova contributed to this report.