Hong Kong's justice minister has warned that posting and sharing criticism of the city's newly enacted national security law could be in breach of the legislation, which lays down harsh penalties for sedition.

Article 23, which came into force on Saturday, includes penalties of up to life imprisonment for five categories of crime — treason, insurrection, espionage, sabotage and external interference.

It also expanded the British colonial-era offense of "sedition" to include inciting hatred against China's Communist Party leadership.