Hong Kong’s legislature has approved a sweeping, Beijing-drafted overhaul of the city’s elections, dramatically curtailing the opposition’s ability to participate in government on the same day that authorities banned a massive pro-democracy vigil.

The Legislative Council voted 40-2 to approve measures Thursday creating a review committee to vet candidates for elected office and ensure they are "patriots.” All candidates must also be approved by national security officials in the Hong Kong police force to determine whether they can be trusted to uphold local laws and "respect” the ruling Communist Party.

The bill’s passage marks the culmination of Beijing’s efforts to take control of how the former British colony chooses its leaders, giving it a veto over candidates for office following historic and sometimes violent unrest in 2019. It effectively ends China’s only experiment with open elections, a vestige of the democratic system implemented during last years of colonial rule.