This came after the Department of Justice sought legal advice from the appeal court on the principle of "joint enterprise" - whether suspects who were not at the scene could still be liable for offenses as long as they shared a common purpose.

Student Natalie Lee Yuen-yui, 17, gym owner Tong Wai-hung, 40, and his wife Elaine To, 43, were acquitted of rioting charges as district court judge Anthony Kwok Kai-on said they did not assemble at the crime scene.

The department did not seek a reversal of their acquittals, but a clarification on the legal principle.

In a written judgment yesterday, high court chief judge Jeremy Poon Shiu-chor, court of appeal vice-president Andrew Macrae and judge Anthea Pang Po-kam said "joint enterprise" prosecutions should be allowed in rioting and unlawful assembly cases.

"Unlawful assemblies and riots nowadays are highly fluid in nature," said the judges. "They involve a myriad of participants playing various roles and sometimes with a rather sophisticated division of labor among them.

"Some physically participate in the unlawful assembly or riot at the scene. Some aid or abet the participants at the scene."

The court said people who could be prosecuted under the joint enterprise legal principle include masterminds and funders of the assemblies, those who encourage or provide back-up support to the event participants as well as lookouts who would alert the participants.

"Given the prevalent use of social networking applications such as WhatsApp, Instagram, Telegram and Facebook, people nowadays can easily find themselves placed in situations where they can be accused of encouraging people to participate in unlawful assemblies or riots by posting comments or sending messages or even by simply giving a 'like,'" the judges said.

Freedom of expression is not absolute and people could not commit offenses "in the disguise of exercising their freedom of expression," the judges warned.

"If there is sufficient evidence to establish their liability under the accessorial rules or the doctrine of joint enterprise, they are no longer innocent people exercising their freedom of expression.

"They have crossed the permissible line and become a perpetrator to an unlawful assembly or riot and should be held liable as such."

The court also stressed there is "no overcharging" for prosecuting those people even if they are not present at the assembly scene.