Nine Hong Kong activists and ex-legislators have been handed jail sentences of up to 10 months over their roles in last year's banned Tiananmen Square candlelight vigil, the latest blow in a crackdown on dissent in the city.

The nine are part of a group of 12 defendants who pleaded guilty earlier this month to participating in the vigil that was the only large-scale public commemoration on Chinese soil of the 1989 crackdown in Beijing on student-led protests. Three others were given suspended sentences.

They were all charged with taking part in an unauthorised assembly, with seven facing an additional charge of inciting others to take part.

Police last year banned the annual vigil for the first time in three decades, citing public health risks from the coronavirus pandemic.

Critics believe the ban is part of the crackdown on opposition in the semi-autonomous Chinese territory following months of anti-government protests in 2019.

More than a dozen activists initially turned up at the June 4 vigil despite the ban and thousands followed suit. The crowds broke through barriers set up around the Victoria Park venue to light candles and sing songs despite police warnings.

Officers later arrested more than 20 activists, including leaders of the Hong Kong Alliance in Support of Patriotic Democratic Movements of China, the association that organises the yearly vigil.

Some of those sentenced on Wednesday, such as lawyer Albert Ho and Figo Chan, former leader of the now-defunct Civil Human Rights Front, are already serving jail sentences over other unauthorised assemblies.

Eight other activists charged over last year's Tiananmen vigil, including Jimmy Lai, founder of the defunct Apple Daily newspaper, and alliance leader Lee Cheuk-yan, have pleaded not guilty and will stand trial in November.

Prominent pro-democracy activist Joshua Wong and three others had previously pleaded guilty over their roles in the event and were sentenced to between four and 10 months in jail.

Last June, Beijing imposed a sweeping national security law on Hong Kong that targets secession, subversion, terrorism and foreign collusion in the city's affairs. More than 100 people have been arrested under the law.

Beijing and Hong Kong officials have been criticised for rolling back freedoms promised to Hong Kong for 50 years when the former British colony was handed over to China in 1997.