China has imposed a sweeping new national security law on Hong Kong that opponents say undermines the semi-autonomous city's liberties. Here are the key developments since Beijing first floated the legislation. - 'Enforcement mechanisms' - On May 22 China unveils plans to strengthen "enforcement mechanisms" in Hong Kong. A draft proposal for the law says it will "guard against, stop and punish any separatism, subversion of the national regime, terrorist group activities and such behaviours that seriously harm national security". But the precise content of the legislation is kept hidden from Hong Kong's 7.5 million residents. An attempt by the Hong Kong government to introduce a similar law in 2003 sparked huge protests and was eventually shelved. Beijing's new plan draws a rebuke from many Western nations, which say China is eradicating the freedoms it promised the city under its handover from Britain in 1997. - Washington takes a stand - The United States on May 27 revokes Hong Kong's special status under US law, paving the way to strip the city of its trading privileges. Washington accuses Beijing of trampling on the territory's autonomy. The next day China's parliament endorses the law despite mounting pressure from the West. - Law passed - Two weeks after it was first unveiled, China passes the security law on June 30, only revealing its wording later that evening. The legislation is unanimously approved by Beijing's rubber-stamp parliament and signed by President Xi Jinping, according to the official Xinhua news agency. It allows Beijing jurisdiction over cases deemed to be serious breaches and introduces life sentences for the worst offences. It also allows China's security agents to operate openly in Hong Kong for the first time. Four young pro-democracy leaders announce the same day they are resigning from their party, Demosisto, which is then disbanded. One of them, Nathan Law, flees the territory. On July 1, the 23rd anniversary of Hong Kong's return to Chinese rule, the first arrests are made under the new law. Most of those arrested were flying flags and carrying pamphlets calling for Hong Kong's independence from China. One man was charged with secession and terrorism for allegedly driving his motorbike into police while waving an independence flag. - International reaction - Twenty-seven member states of the United Nations Human Rights Council, including France, Germany and Japan, call on China to revise the text. Britain says it will open its door to migrants from Hong Kong, judging the law to be a breach of the 1984 Joint Declaration signed by Beijing and London. US Secretary of State Mike Pompeo threatens China with sanctions, saying it is a "sad day" for Hong Kong. The United States Congress then adopts a law providing for sanctions against Chinese officials who apply the new security rules against Hong Kong. The US legislation also targets banks that finance those officials. Canada says it is suspending its extradition treaty with Hong Kong. China says it will respond with reciprocal measures against any moves to punish it for the law. - Books pulled, tech firms rattled - Hong Kongers start scrubbing and deleting social media accounts. On July 3 a number of books written by democracy activists are withdrawn from Hong Kong libraries, and three days later the government orders schools to get rid of books that could be in breach of the law. Three days later the government announces enhanced surveillance powers for police, including the power to censor the internet if posts breach the national security law. Facebook, Google and Twitter say they will no longer respond to requests for information on their users from Hong Kong authorities while the tech giants review the impact of the legislation. Video app TikTok, owned by Beijing-based ByteDance, announces several hours later that it will pull out of Hong Kong. On Wednesday China opens a new office for its security agents to operate openly in the city for the first time, transforming a hotel into the force's headquarters. Police walk past a plaque outside the Office for Safeguarding National Security of the Central People's Government in the Hong Kong Special Administrative Region after its official inauguration Main points of the security surveillance powers Hong Kong police have been granted under the new sweeping national security law.