In the harshest crackdown on protest in Moscow in more than 1 1/2 years, helmeted riot police charged and clubbed demonstrators who broke away from a candlelight vigil at KGB headquarters commemorating Stalin's victims.

Scores of protesters were knocked to the ground, beaten and dragged into police buses in Monday night's confrontation. Tass said about 40 were detained.The official news agency said the protesters, many of them members of the opposition Democratic Union, were "trying to create as much disruption as possible, to display anti-Soviet posters and shout anti-Soviet slogans."

The violence occurred on some of central Moscow's busiest streets and was especially jarring because police have lately been more tolerant toward dissent under President Mikhail S. Gorbachev's policy of greater openness.

About 1,000 people had converged on KGB headquarters at Dzerzhinsky Square after dusk to mark the unofficial "Day of the Political Prisoner" and mourn the millions wrongly imprisoned or killed under Josef Stalin.

Two rows of people holding flickering candles lined up on three sides of the building, home of the infamous Lubyanka prison where, under Stalin, political prisoners were executed with a shot to the back of the head.

At vigil's end, a splinter group of about 500 people, mostly young men, marched off toward Pushkin Square, a favorite rallying site for human rights activists.

Chanting, "Shame on the KGB!" and "The KGB is the enemy of the people!" the group was confronted without warning by riot police two blocks from Pushkin Square as they passed out leaflets to homebound commuters.