Four student leaders from Hong Kong's top university have been arrested for "advocating terrorism", police said.

A controversial student union statement following an attack on a police officer last month sparked the arrests, according to a spokesman from the city's national security police unit.

On 1 July, a man stabbed and wounded a police officer in a busy shopping district before taking his own life in what authorities called an act of "domestic terrorism".

Shortly afterwards, the University of Hong Kong's (HKU) student union released a statement expressing "deep sadness" over the attacker's death and appreciation for his "sacrifice".

The statement proved hugely controversial even as the union retracted the statement and apologised for its wording.

Last month, police raided the union's offices, campus TV station and undergraduate office.

HKU's management also banned the union's council members from campus.

Advocating terrorism carries up to ten years in jail and is covered by Hong Kong's national security law.

That law, imposed on the city last year by Beijing in response to huge and often violent democracy protests two years ago, has quickly criminalised much dissent.

It covers offences deemed as subversion, secession, terrorism and collusion with foreign forces.

More than 130 people, including many democracy advocates, have been arrested under the law -- the majority for secession or subversion charges for expressing their political views.

Terrorism charges are rarer.

The security law has been combined with an official campaign to purge Hong Kong of any elements deemed "unpatriotic".

Over the past year, more than 30 professional and political groups have disbanded following investigations by authorities.

On Wednesday the 612 Humanitarian Relief Fund, established to support democracy protesters, became the latest to announce it was shutting down.

Pro-Beijing media singled out the group as a "fundraising platform for rioters" saying it must be "eliminated".