A young Hong Kong democracy activist was sentenced to three and a half years behind bars on Tuesday after pleading guilty to secession under the city's sweeping national security law.

Tony Chung, 20, is the youngest person to be convicted under the new law which has crushed dissent in Hong Kong and transformed the once outspoken international business hub.

Earlier this month he pleaded guilty to one count of secession and one count of money laundering but defiantly declared he had "nothing to be ashamed of".

Chung was previously the convenor of Student Localism, a small group he set up five years ago as a secondary school pupil to advocate Hong Kong's independence from China.

Separation from China was then a fringe minority view in Hong Kong although calls for self-rule became more vocal during huge and often violent democracy protests two years ago.

Beijing imposed the security law on Hong Kong in response to those protests and Student Localism disbanded hours before it came into effect.

Authorities accused Chung of continuing to operate the group with the help of overseas activists and soliciting donations via PayPal -- the foundation of the money laundering charge.

Prosecutors said Chung's group published more than 1,000 social media posts that included calls to "get rid of Chinese Communist colonial rule" and "build a Hong Kong republic".

Some of the posts prosecutors cited dated back to before the security law's enactment, despite Hong Kong authorities promising that the law would not be retroactive.

On Tuesday Stanley Chan, one of a group of select judges picked by the government to try national security cases, said Chung's criminal intent was "clear for all to see" on social media, in interviews, at street booths and in schools.

Chung has already spent more than a year in custody after he was arrested in October 2020.

He was arrested by plainclothes police from a coffee shop opposite the US consulate, where he was allegedly planning to seek asylum.

The security law targets anything authorities deem subversion, terrorism or collusion with foreign forces.

Chung initially faced an additional charge of sedition and another count of money laundering but they were shelved following a plea bargain.

In a separate case last December, Chung was jailed for four months for unlawful assembly and insulting China's national flag.

Four other men have so far been convicted in separate cases under the security law -- mostly for their political views.

More than 150 people have been arrested under the legislation, with around half charged.

Bail is often denied and guilty pleas are a way to reduce both the end sentence and the legal costs of a long court battle.