HONG KONG — A court on Wednesday sentenced Hong Kong democracy activists Joshua Wong, Agnes Chow and Ivan Lam to between seven and 13½ months in prison for organizing and taking part in an unauthorized protest, as China seeks to eradicate dissent in the city.

The activists, all in their 20s, had pleaded guilty to leading, inciting and participating in a protest around the Hong Kong police headquarters last year, during the early stages of what became the biggest uprising against Communist Party rule on Chinese soil since 1989.

It is the fourth stint in prison for Wong, 24, who as a teenager became a symbol of the former British colony’s democracy movement and its struggle to preserve its promised freedoms and autonomy from Beijing’s authoritarianism.

In delivering the sentence, the magistrate, Lily Wong, said community service or a noncustodial penalty would be inappropriate for Lam and Joshua Wong, citing their criminal records — all relating to their political activism. The June 21, 2019, protest at police headquarters was “well planned,” the judge said, as she cited messages sent by Joshua Wong through the messaging app Telegram urging people to gather.

Although the protest was peaceful, “the court needs to remember the importance of protecting public order,” she said before a courtroom packed with the defendants’ supporters and observers who lined up for hours to get in.

Hong Kong’s mini-constitution, the Basic Law, states that residents have freedoms, including the right to demonstrate. Protesters at the rally in question had blocked roads around the police complex but were not violent, the judge noted.

Wong, who received the longest sentence, faces other charges related to his involvement in Hong Kong’s democracy movement, including violating a ban on masks at protests. He has been barred several times from running for office. Lam, the son of a police officer, was sentenced to seven months.

Chow, who turns 24 on Thursday, sobbed as she learned she would serve 10 months — her first stint in prison — and her supporters in the courtroom broke down in tears.

Other charges against Wong and Chow could extend their time in custody. Chow was recently arrested under Beijing’s new national security law for allegedly inciting secession, punishable by life in prison.

For these activists, “it is now the Chinese Communist Party’s plan, I think, to start an indefinite detention for them, by giving them new charges again and again,” said Eddie Chu, a former pro-democracy lawmaker who has campaigned with Wong and who is also facing criminal charges. “For them, the treatment will be much more politically motivated,” he added.

All three were remanded in custody last week ahead of their sentencing. Wong was held over recent days in solitary confinement, and he had to use a surgical mask to shield his eyes from lights that were never turned off, according to friends who visited him.

Solitary confinement “is indeed hard to endure,” he wrote in a letter from his cell, “but as many Hong Kong protesters face imprisonment like me, I hope you continue letting them know that they are not alone.”

“Cages cannot lock up souls,” Wong added.

Wong, Chow and Lam initially rose to prominence as teenage activists who resisted the Communist Party’s attempts to push its official narrative in school learning materials.

They were central figures in the 2014 Umbrella Movement, a 79-day street occupation that called for Hong Kongers to be allowed to directly elect their leaders. After those protests fizzled out without concessions from Beijing, the trio formed Demosisto, a political party that promoted Hong Kong’s democracy cause in the United States, Britain, Japan and elsewhere.

Another core member of their group, 27-year-old Nathan Law, fled Hong Kong this year over the national security law.

Although the 2014 protests failed to achieve their goals, they solidified a sense of a Hong Kong political identity, distinct from the Chinese mainland. That laid the groundwork for the massive anti-government protests that began in June last year, in which more than 10,000 people were arrested.

Wong did not play a central role in last year’s upheaval, which was characterized by a leaderless, fluid form of civil disobedience later replicated in places like Thailand. But he has continued to draw international attention to Hong Kong’s struggle, campaigning in the United States and Germany. He has also spoken in support of other democracy movements, including those in Belarus and Thailand, and the Black Lives Matter protests in the United States.

The activists’ imprisonment comes as China pursues a wider crackdown on political opposition that has accelerated since the national security law took effect this summer, shutting off avenues of peaceful dissent in Hong Kong.

Last month, Beijing forced the ouster of four pro-democracy lawmakers on the grounds that they were insufficiently patriotic, prompting a walkout of their camp and ending any meaningful opposition in Hong Kong’s legislature for the first time since the territory’s 1997 handover from Britain. Books, including those written by Wong, have disappeared from libraries, while teachers have been deregistered and journalists arrested. 

Wong had recently rallied support for 12 Hong Kong residents who were detained at sea by Chinese authorities while trying to flee to Taiwan.

“Right now, for those who are in custody, the most difficult part is they are witnessing a pretty demoralized society, with many talking about emigration,” said Chu.

As he was led away from court on Wednesday, Lam shouted that he had “no regrets.” Wong, meanwhile, said he would “stay strong.”