A Hong Kong court has sentenced activist Edward Leung to six years in prison for his part in a violent nightlong clash with police over illegal street food hawkers two years ago.

Leung, 26, was among a generation of young political activists who emerged after 2014's failed nonviolent protests over Beijing's decision to restrict elections.

His sentence shows the hard line authorities are taking toward those advocating for more open politics in the former British colony.

Chinese President Xi Jinping warned in a speech last year marking 20 years since the city became a semi-autonomous region of China that any activities in Hong Kong seen as threatening China's sovereignty and stability would be "absolutely impermissible."

Under the "one country, two systems" blueprint, Hong Kong retains civil liberties including free speech.