A Hong Kong waiter has been jailed for nine years after he became the first person convicted under a sweeping new national security law that Beijing imposed on the city to stamp out dissent.

Tong Ying-kit, 24, was convicted on Tuesday of terrorism for driving a motorbike into three police officers and secession for flying a protest flag during a rally on 1 July last year, the day after the national security law was enacted.

The trial was a watershed moment that laid down a new marker in the city's changing legal landscape and confirmed that certain outlawed political slogans now carry lengthy jail terms.

The flag Tong flew read "Liberate Hong Kong, revolution of our times", a chant often heard during the huge and often violent pro-democracy protests that took place around two years ago.

His trial was heard without a jury, a significant departure from Hong Kong's common law tradition.

The verdict was decided by three judges handpicked by the city's leader to try national security crimes.

On Tuesday, those judges ruled that Tong driving his bike into police met the bar for terrorism while the flag he flew was capable of "inciting secession".

They sentenced him to eight years in jail for the first charge and 6.5 years for the second but said some of time could be served concurrently leading to a total of nine years behind bars.

The ruling has profound implications for future national security cases.

More than 60 people have been charged under the law, including some of the city's best-known democracy activists such as Jimmy Lai, owner of the now-shuttered Apple Daily newspaper.

Most are now in jail awaiting trial.