MOSCOW — An approved street protest on Saturday in Moscow against the banning of opposition candidates in a city election drew about 50,000 people, a crowd far larger than the few thousand who recently demonstrated in the Russian capital, where heavy-handed policing typically dampens turnout.

After protesters obtained a permit, they turned out in force for what was the largest demonstration in Moscow in years. The crowds were comparable in size to those who gathered in 2015 to mourn the murdered opposition leader Boris Y. Nemtsov and to demonstrations during the 2012 election year.

Along with a demand that opposition candidates be allowed on the ballot for City Council elections, protesters demanded Saturday that the authorities release those detained at past rallies. “Release! Release!” the crowd of protesters chanted at one point.

The 50,000 count came from a nongovernmental group; the police stopped issuing updates after the crowd surpassed 20,000. A rapper who goes by the stage name Oxxxymiron and a popular blogger had encouraged people to attend.