The trouble came after a march targeting what demonstrators called "The Exclusion Games" had come to a peaceful end in at the leafy Afonso Pena square near the Maracanã stadium. Half an hour later, the acrid smell of the gas still drifted over the square.
It was the second demonstration on the opening day of these Olympics -- earlier a crowd of a few thousand had protested the government of interim president Michel Temer and the Games on Copacabana seafront. In previous days, demonstrators protested as the Olympic torch made its way around Rio's outlying towns and police used tear gas on at least two other occasions.
Anna Faro, 25, said the demonstrators had been protesting the evictions "or cleansing and gentrification" of poorer communities or favelas for Olympic works, and killings by police in the state of Rio.
As she spoke, a masked protester beat out a rhythm on a TV satellite dish on which Olympic rings had been drawn. Despite the presence of a large contingent of riot police in protective clothing who had followed the march, the mood was peaceful.
Then there was shouting, panic and people began running across the square, followed by police. A percussion grenade boomed. Tear gas sent more people running in different directions as police formed a line. As quickly as it had flared, the trouble dissipated, but the tension remained.
Italian photographer Luigi Spera had filmed protesters burning a Rio 2016 volunteer T-shirt and a Brazilian flag. Beatriz Nunes, 34, was one of a number of teachers who had come from a meeting to join the march. Teachers in Rio state spent months on strike and have received salaries late. In June the state declared a "state of calamity" in its finances and was bailed out by the central government.
Nunes said that when some protesters tried to pass a police line, officers had reacted with tear gas and the percussion grenade. “They do this to disperse people,” she said.
The tactic was not entirely successful. Gaggles of protesters hung around the square. Others shouted abuse at police who arrested a young black man, and then briefly seized the wallet of lawyer Rodrigo Assef, who intervened. He said the police actions at the end of the demonstration had been “Terrible, the worse possible.” First-aid personnel helped a young woman who had passed out – witnesses said she had inhaled tear gas.