MOSCOW — The Russian police detained about 20 gay rights protesters on Monday, among them the leader of a group that is helping gay men escape from the southern province of Chechnya, where they face abuse, including torture.

The protesters held a demonstration on the sidelines of a May Day parade in St. Petersburg, Russia’s second-largest city.

The treatment of gays in Chechnya has prompted protests outside Russia, but the demonstration on Monday was the first significant action inside the country, and it ended, perhaps predictably, with arrests. Russia has strict rules on political activity in public.

Some protesters lay on the pavement draped in a rainbow flag and the flag of Chechnya. Others carried placards objecting to the mistreatment of gay men in Chechnya, news footage showed.