PARIS — The French police played cat-and-mouse with demonstrators and masked and hooded vandals at the traditional May Day rally in Paris on Wednesday, firing tear gas and charging protesters with truncheons raised, but the large law enforcement presence kept violence below levels feared before the march.

Some store windows were smashed along the parade route, which stretched across the Left Bank of the capital. Vandals threw rocks at a police station and unsuccessfully tried to enter it, and clouds of tear gas floated over the route. In Paris a media consortium counted about 40,000 demonstrators made up of union members, “Yellow Vest” protesters and vandals. The police said there were 28,000.

Some violence always accompanies the May Day rally, but this year the government had warned that the risk was higher since the demonstration would unite the violent elements of the Yellow Vest movement, labor militants and the so-called Black Blocs — a loose international group of anarchist and anticapitalist vandals dressed in black who smashed numerous shop windows last year.