PITTSBURGH  As the two-day Group of 20 meeting brought leaders of the world’s industrialized nations here Thursday, the police were out in force, patrolling on bicycles, foot and horseback, by river and by air.

In the afternoon, protesters trying to march toward the convention center where the gathering is being held encountered roaming squads of police officers carrying plastic shields and batons. The police fired a sound cannon that emitted shrill beeps, causing demonstrators to cover their ears and back up, then threw tear gas canisters that released clouds of white smoke and stun grenades that exploded with sharp flashes of light.

City officials said they believed it was the first time the sound cannon had been used publicly. “Other law enforcement agencies will be watching to see how it was used,” said Nate Harper, the Pittsburgh police bureau chief. “It served its purpose well.”

The protesters, who did not have a permit to march, rolled a large blue metal trash container down 37th Street. It stopped short of police vehicles and in front of a women’s clothing and shoe boutique called Pavement.