HONG KONG — Nearly three years after sweeping pro-democracy protests filled the streets of Hong Kong, a local court delivered the struggling movement a severe blow on Friday, removing four legislators from office and assuring China greater influence over the city’s government.

The pro-democracy lawmakers were dismissed from the Hong Kong Legislative Council because they had used unacceptable words or even dubious tones in taking oaths of office that require declarations of loyalty to China. The ruling means that democracy advocates in the semiautonomous city’s legislature will no longer have enough votes to block legislation from their pro-Beijing counterparts.

“Voters entrusted us with the task of monitoring the government,” said Leung Kwok-hung, one of those unseated. “We’ve lost that power.”

Hong Kong has been rattled by episodes that have raised fears that China is reaching deeper into the city to enforce its will. A bookseller who sold lurid titles about China’s leaders was abducted and taken to mainland China. Xiao Jianhua, a prominent billionaire who grew up in China, was snatched from a high-end hotel and brought to the mainland.