China's parliament passed national security legislation for Hong Kong on Tuesday, setting the stage for the most radical changes to the former British colony's way of life since it returned to Chinese rule 23 years ago. Hong Kong leader Carrie Lam told the main UN human rights forum that the legislation would fill a "gaping hole" and would not undermine its autonomy. Ms Lam, in a video message to the Human Rights Council in Geneva, said that legislation to safeguard national security was "urgently needed" for the sake of 7.5 million Hong Kong residents, but also the 1.4 billion people on the mainland. Hong Kong had been "traumatised by escalating violence fanned by external forces", she said. "No central government could turn a blind eye to such threats to sovereignty and national security as well as risks of subversion of state power. "All in all these acts have crossed the 'one country' red line and called for resolute action." She said Hong Kong's Basic Law – which enshrines the principle of "one country, two systems" – protects freedoms of speech, assembly and the press. "In short, the legislation will not undermine 'one country, two systems' and Hong Kong's high degree of autonomy," she said. "The legislation aims to prevent, curb and punish acts of secession, subversion of state power, terrorist activities and collusion with foreign or external forces to endanger national security. These crimes will be clearly defined in the law." Hong Kong was rocked by months of sometimes violent unrest last year, with protesters angry at perceived meddling by Chinese Communist Party rulers in the city's freedoms. China denies interference. Ms Lam said that except for "rare specified situations", Hong Kong would exercise jurisdiction over offences under the law, which would not affect Hong Kong's "renowned judicial independence". "We will only target an extremely small minority of people who have breached the law, while the life and property, basic rights and freedoms of the overwhelming majority of Hong Kong residents will be protected," she said.