Police say a 19-year-old man pulled a semi-automatic pistol and that subsequent search yielded a rifle and ammunition.

Hong Kong police said an armed suspect fired a live round at officers as they tried to arrest him in an operation linked to the months of pro-democracy protests engulfing the city.

Police said on Saturday that a 19-year-old man pulled out a semi-automatic pistol as officers approached him in Tai Po district on Friday evening. The shot did not hit anyone and the man was subdued.

A subsequent search of a nearby flat uncovered an AR-15 semi-automatic rifle and more than 250 rounds of ammunition.

Police said they believed the man and the weapons were linked to a group arrested earlier this month allegedly in possession of a pistol and plotting to attack officers.

Riot police had to be called in to back up the officers as local residents began heckling police, with at least two tear gas rounds fired to disperse them, the South China Morning Post reported.

Semi-autonomous Hong Kong has been shaken for six months by increasingly violent pro-democracy protests.

They were initially sparked by a now-abandoned attempt to allow extraditions to mainland China but have since morphed into a popular revolt against Beijing’s rule, with spiralling fears that the city is losing some of its unique liberties.

Millions have marched peacefully in multiple rallies. But youths armed with petrol bombs, bricks and sometimes bows and arrows have added a dangerous layer to the movement, leading to increasingly violent battles with riot police.

Over the last six months, police have fired more than 16,000 rounds of tear gas and 10,000 rubber bullets. Some 6,000 people have been arrested, with 1,000 charged – a large chunk of them students.

In recent weeks, police have made arrests indicating some protesters may be plotting more drastic action.

Hong Kong leader Carrie Lam and its police force’s reputation have taken a hammering during the protests but Beijing has publicly backed both.

The South China Morning Post published a new poll earlier this week which found 73 percent of respondents felt the police’s handling of the protest had eroded trust in the force.

Among the demands being made by protesters is an independent inquiry into the police, amnesty for those arrested and fully free elections.