HONG KONG – A Hong Kong court sent young activist Joshua Wong and two other student leaders to prison Thursday for their roles in huge pro-democracy protests nearly three years earlier, in the latest sign that tolerance for dissent is waning in the Chinese-ruled former British colony.

The High Court overturned an earlier verdict that let Wong, Nathan Law and Alex Chow avoid prison, agreeing with prosecutors that the original punishment for joining or leading an unlawful assembly that sparked the protests was too light.

They were immediately taken to serve their sentences of up to eight months, which have the added consequence of blocking each of them from seeking public office for five years.

Wong had little visible reaction as the verdict was read out but tweeted minutes after: “You can lock up our bodies, but not our minds! We want democracy in Hong Kong. And we will not give up.”

“See you soon,” he added.

He pumped his fist in the air as he walked out of the dock into custody.

The three were found guilty last year of leading or encouraging an illegal rally in September 2014 that kicked off the “Umbrella Movement” protests that captured world headlines. Youthful activists brought major thoroughfares to a standstill for 11 weeks to protest Beijing’s plan to restrict elections in the semi-autonomous region.

Wong and Law were originally given community service and Chow had received a suspended three-week prison sentence.

A three-judge panel on Thursday decided to stiffen those sentences following the justice secretary’s request. The judges, who said there was a need to deter others, gave Law eight months in prison, seven to Chow and six for Wong, following deductions that included one-month cuts in sentences for the community service Wong and Law completed.

Their supporters said they plan to appeal.

The case raises fears that Hong Kong’s independent judiciary is under threat as the city’s Beijing-backed government uses the courts to clamp down on the opposition and constrain its ability to protest.

Under the “one country, two systems” format that took effect after the 1997 handover from Britain, Beijing promised to let the city keep its wide autonomy and civil rights like freedom of speech and protest unknown on mainland China. But many residents and analysts fear China’s communist leaders are backtracking on their promises.

It’s “going to have a chilling effect on freedom of expression and the right to peaceful assembly and may deter other people from taking part in similar demonstrations in the future,” said William Nee of Amnesty International.

The ruling is also a setback for the city’s next generation of pro-democracy political leaders, because it prevents the movement’s most charismatic leaders from running for office. Anyone sentenced to at least three months in prison can’t stand for public office for five years.

Last year, Law became the youngest person to be elected to the city’s legislature at age 23, but was among half a dozen lawmakers later disqualified for using their oaths to make apparent protests against Beijing. Wong, 20, has also spoken of his desire to stand for election but is still too young. Chow, 27, was set for graduate school but the case derailed his plans.

“The government is determined to put peaceful protesters behind bars to mute all dissidents by abusing judicial procedures,” their political party, Demosisto, said in a statement.

Before the ruling, Wong, who became famous for his role in the protests because he was just 17 and still in high school at the time, was defiant.

“People united will never be defeated,” Wong told a huge throng of media outside the courthouse, flanked by his co-defendants. He vowed they would continue “this long battle” for freedom and democracy.

“Time is on our side and one day Hong Kong will be a place we can determine our own future. We love Hong Kong,” he said into a microphone as a rival, pro-Beijing protester chanted, also on a microphone, nearby.

The appeal judges at the High Court had been expected to send the three to prison, following their decision in a similar case this week involving 13 activists given eight to 13 months’ jail time after their original community-service sentences were overturned.

Wong had been girding for such a possibility and tweeted earlier to his followers that they shouldn’t abandon the movement.

“When those of us who face jail time have yet to give up, how can the rest of you give up?” wrote Wong, who is now in university. He added that he promised to keep up with his studies.

KELVIN CHAN