HONG KONG (Reuters) - Hong Kong’s highest court freed three young leaders of the city’s pro-democracy movement on Tuesday, including the public face of the protests, Joshua Wong, in a stark reversal of an earlier ruling, but it warned against future acts of dissent.

The unanimous decision was made by a panel of five judges on the Chinese-ruled city’s Court of Final Appeal, led by Chief Justice Geoffrey Ma. Wong, 21, Nathan Law and Alex Chow had served roughly two months in jail before they were granted bail in November.

Before that, a magistrate’s court had ruled the activists should serve community service and a suspended sentence for a charge of “unlawful assembly” after they and others stormed into a fenced-off area in front of government headquarters in September 2014.

That sparked a night-long standoff with police and was seen as a key trigger for the “Umbrella Movement” that blocked major roads in the city for 79 days in a push for full democracy, presenting Communist Party rulers in Beijing with one of their biggest political challenges in decades.

But this non-jail sentence was challenged by Hong Kong’s Department of Justice that pushed for a review, eventually leading the Court of Appeal to impose jail terms.

The five judges, including a non-permanent foreign judge, Lord Leonard Hoffmann, said in the judgment that they had “quashed the sentences of imprisonment” by the Court of Appeal.

They stressed, however, that Hong Kong was a law-abiding society and that “future offenders involved in large-scale unlawful assemblies involving violence” will be subject to stricter guidelines laid down by the Court of Appeal.

Slideshow ( 4 images )

Hong Kong, a former British colony, returned to Chinese rule in 1997 with a guarantee of wide-ranging freedoms, including an independent judiciary and freedom of speech, but critics accuse Beijing of creeping interference in the city’s affairs and the government of toeing the Beijing line.

The three activists were somber despite being freed, saying future activists could be unjustly punished for civil disobedience, even acts aimed at defending local rights and freedoms.

“It’s not a time for celebration ... It’s a long term battle for us in the future,” said Joshua Wong.

“Maybe more and more activists will be locked up because of this harsh judgment ... We must urge people to continue to fight for democracy.”

The judges said: “There is no constitutional justification for violent unlawful behavior. In such a case involving violence, a deterrent sentence may be called for and will not be objectionable on the ground that it creates a ‘chilling effect’ on the exercise of a constitutional right.”

Amnesty International’s Hong Kong director, Mabel Au, said in a statement that the court had: “corrected an injustice” but added that “all politically motivated prosecutions aimed at silencing those promoting democracy in Hong Kong must be dropped”.

Besides the trio of Wong, Law and Chow, dozens of other mostly young democracy activists have also been jailed, or are facing court proceedings that could see them incarcerated for various forms of rights activism, in what some see as a concerted attempt by authorities to curtail the momentum of the city’s youth-led democracy movement.

“This will have some impact on Hong Kong’s activism ... the norm is different now and has shifted to heavier sentences,” said Jonathan Man, a lawyer who has represented some of these rights activists. “This is setting a precedent.”