It follows a national security trial that has damaged the city's once feisty democracy movement and drawn criticism from the US and other countries.
A total of 47 pro-democracy activists were arrested and charged in 2021 with conspiracy to commit subversion under a Beijing-imposed national security law, which carried sentences of up to life in prison.
Benny Tai, a former legal scholar identified in the judgment as a mastermind of the activists' plans, was sentenced to 10 years in jail, the longest sentence so far under the 2020 national security law.
The charges related to the organising of an unofficial "primary election" in 2020 to select candidates for a legislative election. Prosecutors accused the activists of plotting to paralyse the government by engaging in potentially disruptive acts had they been elected.
Some Western governments have criticised the trial, with the US describing it as "politically motivated" and saying the democrats should be released as they had been legally and peacefully participating in political activities.
The Chinese and Hong Kong governments say the national security laws were necessary to restore order after mass pro-democracy protests in 2019, and the democrats have been treated in accordance with local laws.
CLOSELY WATCHED TRIAL
After a 118-day trial, 14 of the democrats were found guilty in May, including Australian citizen Gordon Ng and activists Owen Chow and Gwyneth Ho, while two were acquitted.
The other 31 pleaded guilty. All 45 were given sentences ranging from four to 10 years.
"Our true crime for Beijing is that we were not content with playing along in manipulated elections," Ho, who was sentenced to seven years imprisonment, wrote in a Facebook post.
"We dared to confront the regime with the question: will democracy ever be possible within such a structure? The answer was a complete crackdown on all fronts of society."
The US State Department condemned the sentences and said it was imposing new visa restrictions on multiple Hong Kong officials responsible for implementing the national security law, without saying how many officials were targeted.
"The defendants were aggressively prosecuted and jailed for peacefully participating in normal political activity protected under Hong Kong's Basic Law," a department spokesperson said in a statement. The US urged Hong Kong authorities to cease "politically motivated prosecutions" and release all political prisoners, the spokesperson said.
Australia's Foreign Minister Penny Wong said she was "gravely concerned" about the sentences, and called on China to "cease suppression of freedoms of expression, assembly, media and civil society" in Hong Kong.
Chinese foreign ministry spokesman Lin Jian told reporters: "No one can engage in illegal activities in the name of democracy and attempt to escape legal punishment".
Beijing "firmly supports" Hong Kong's efforts to safeguard national security, he added.
Chow was sentenced to seven years and nine months in jail, while prominent activist Joshua Wong was sentenced to four years and eight months in jail, and Hendrick Lui was sentenced to more than four years in jail.
Afterwards, Lui's mother Elsa Wu shouted: "He's a good person. He’s not a political prisoner. Why does he have to go to jail?"
Lawyers for some defendants who have been detained for more than 3-1/2 years said they expected to have this time deducted from the sentences, meaning some could be released next year.
CROWDED COURTROOMS
The judges Andrew Chan, Alex Lee and Johnny Chan wrote that in passing sentence they considered factors including the degree of planning, the number of people involved and the potential harms generated irrespective of whether the scheme would have taken place or not.
"In order to succeed, the organisers and participants might have hurdles to overcome, that however was expected in every subversion case where efforts were made to overthrow or paralyse a government. We therefore rejected the proposition that the Scheme was doomed to fail and that a lighter sentence should be imposed," the judges wrote.
The judges, however, granted a one third reduction in the sentences for some who pleaded guilty, including Tai.
Hundreds of people had queued from the early hours outside the court to try to secure a seat within the main courtroom and several spillover courts.
Police were deployed outside the West Kowloon Magistrates' Court and for several blocks in the vicinity with police dogs, an armoured truck and vehicles with lights flashing. Some people were searched and questioned.
"I feel such an injustice needs witnessing," said one woman who gave her name as Margaret and had been in the queue since Sunday afternoon. "They [the democrats] need to know they still have public support."
The ruling, which critics have said tarnishes Hong Kong's role as a global financial hub, comes as the city is hosting an international financial summit to attract more business.
U.S. President-elect Donald Trump's nominee as secretary of state, Marco Rubio, has been a staunch critic of the trial and in an earlier open letter criticised the convictions as evidence of the national security law's "comprehensive assault on Hong Kong's autonomy, rule of law, and fundamental freedoms".
Taiwan's presidential office condemned the jailings, saying democracy and freedom are universal values and Taiwan will continue to stand in solidarity with Hong Kong.