Hundreds of democracy supporters gathered outside a Hong Kong courthouse on Monday chanting slogans and flashing protest symbols as many of the city's best-known dissidents were charged with subversion. The alleged offence of those arrested for subversion was to organise an unofficial primary last summer to choose candidates for the city's partially elected legislature, in the hope that the pro-democracy bloc might take a majority for the first time and block government legislation. Chinese and Hong Kong officials viewed the primary as an attempt to "overthrow" the city's government and therefore a threat to national security. Beijing is battling to stamp out dissent in semi-autonomous Hong Kong after swathes of the population hit the streets in 2019 in huge and sometimes violent democracy demonstrations. It has blanketed the once free-wheeling finance hub in a sweeping national security law, while anti-coronavirus measures ban public gatherings of more than four people. Police on Sunday charged 47 leading dissidents with conspiracy to commit subversion in the largest use yet of the security legislation. Monday's hearing sparked a resurgence of defiance from members of the public in a city where protest has been all but outlawed. Hundreds queued up outside the law courts in one of the biggest gatherings in months as a heavy police presence looked on. Some chanted slogans including "Release all political prisoners" and "Liberate Hong Kong, revolution of our times" – the latter a slogan authorities say is now illegal under the security law. Others flashed the three-finger "Hunger Games" salute that has been embraced by fellow democracy campaigners in Thailand and Myanmar, who have grouped their movements under one umbrella called "the milk tea alliance." Tensions rose and fell throughout the afternoon as police raised banners warning that an illegal gathering was taking place and that protesters were breaking the national security law with their chanting. Crowds did not disperse. Local district councilor Kwan Chun-sang was one of dozens who camped overnight to bag a spot at the front of the queue for the court's public gallery. "Soon after the charges were laid yesterday I decided to come and spend the night here," Kwan told AFP. "I would like to show my support for the pro-democracy activists." A small group of nationalist protesters held banners welcoming the subversion charges. "Punish the traitors severely, enact the national security law and throw them all behind bars," one sign read. The defendants represent a broad cross-section of Hong Kong's opposition, from veteran former pro-democracy lawmakers to academics, lawyers, social workers and a host of youth activists. So many have been charged that officials had to open up three other courtrooms to accommodate the overspill. After a brief appearance by the charged, proceedings were adjourned to later in the afternoon. The dissidents were arrested in a series of dawn raids in January and charged on Sunday with "conspiracy to commit subversion" – one of the new broadly defined national security crimes. They face up to life in prison if convicted. US Secretary of State Anthony Blinken led international criticism of the latest charges, calling for the group's immediate release, as western powers accused Beijing of shredding the freedoms and autonomy it promised Hong Kong could maintain before the territory's handover from the British. Britain and the European Union said the charges showed the law was being used to target political dissent rather than actual threats to national security. China's foreign ministry on Monday dismissed the US criticism and said Beijing "resolutely supports Hong Kong police … in upholding national security as well as Hong Kong's security and stability". The security law was imposed on the city last year and criminalises any act deemed to be subversion, secession, terrorism or collusion with foreign forces. The wording and subsequent application of the legislation has successfully curbed dissent, outlawed a host of political views and radically transformed semi-autonomous Hong Kong's relationship with the authoritarian mainland. Those charged can usually expect to be remanded into custody for months until their trial as the law removes the territory's tradition of granting bail for non-violent crimes.