HONG KONG — More than 40 people appeared in a Hong Kong court on Wednesday charged with rioting for their role in a recent protest that turned violent when thousands of activists clashed with police near Beijing's main representative office in the city.

A wave of protests that began in late April have plunged the former British colony into its biggest political crisis since its return to Chinese rule in 1997, but this is the first time that the authorities in the financial hub have resorted to using the rioting charge.

The 44 charged had been arrested after a peaceful gathering on Sunday in a park in the city's central business district rapidly morphed into running battles between thousands of black-clad demonstrators and police, who fired rubber bullets and tear gas.

Protesters push a burning cart towards police at a demonstration in the Sheung Wan district of Hong Kong on July 28. Billy H.C. Kwok / Getty Images

The use of the anti-riot law could infuriate activists who have been demanding that the government avoid using the term "riot" to refer to the demonstrations. Under Hong Kong law, rioting is defined as an unlawful assembly of three or more people where any person "commits a breach of the peace," and a conviction can carry a 10-year prison sentence.

Most of the defendants were released on bail of $128. The court also imposed a curfew from midnight to 6 a.m. (6 p.m. ET) on most of them, and many were ordered to remain in Hong Kong.

Those charged included 13 students, seven clerks, a pilot from the city's main airline, Cathay Pacific, teachers, nurses, workers and salesmen. All were released on bail and are due back in court on Sept. 25.

"The Chinese government just wants to scare people not to go out and protest again," another supporter named Syrus, 19, said outside the court. "It will deter some of us."

Hundreds of people surrounded a police station late on Tuesday after the 44 activists were charged, and on Wednesday morning, hundreds gathered outside the court house, chanting "revolution of our time" and "liberate Hong Kong."

Even with a typhoon approaching the city and rain lashing down, many of them, huddled beneath umbrellas, stayed on to show solidarity.

"I'm not scared to protest. This whole thing today is just making me more angry," said Gartner, a 21-year-old protester outside the court who declined to give his full name.

Fireworks fired at crowd

The protests were triggered by an extradition bill that would have allowed people to be sent to mainland for trial but they have now evolved into a broader backlash against the city's government and its political masters in Beijing.

Besides calling for the extradition bill to be scrapped, rather than its suspension so far, protesters have also demanded the resignation of city leader Carrie Lam, an independent inquiry into the police's handling of the crisis and the unconditional release of all those arrested.

Since mid-June the protests have escalated and become more frequent, at times shutting government offices, blocking roads and disrupting business as some of the demonstrations degenerated into violent clashes between activists and police.

At a demonstration outside Tin Shui Wai police station in the early hours of Wednesday, the occupants of a passing car fired fireworks into the crowd, injuring six people, police said. There were no immediate arrests, but police issued a statement that "strongly condemned" the attack.

China's Liaison Office, a potent symbol of Beijing's rule over the city since Hong Kong returned from British to Chinese rule in 1997, has become a target for growing ranks of increasingly emboldened youngsters, angry at China's tightening grip on the city's freedoms.

Under a "one country, two systems" formula adopted as part of China's sovereignty, the city was promised wide-ranging freedoms denied citizens in mainland China.

Many fear the central government in Beijing is chipping away at those freedoms.

Edward Leung, one of the leaders of a movement advocating Hong Kong's independence from China, was jailed in June last year for six years for rioting and assaulting police during a protest in a 2016. In an open letter sent from prison earlier this week, Leung urged protesters not to be "controlled by hatred" in these dangerous times, and to remain rational and alert.