BEIJING — China’s Communist Party already wields outsized influence over Hong Kong’s political landscape. Its allies have long controlled a committee that handpicks the territory’s leader. Its loyalists dominate the Hong Kong legislature. It ousted four of the city’s elected opposition lawmakers last year.

Now, China plans to impose restrictions on Hong Kong’s electoral system to root out candidates the Communist Party deems disloyal, a move that could block democracy advocates in the city from running for any elected office.

The planned overhaul reinforces the Communist Party’s resolve to quash the few remaining vestiges of political dissent after the antigovernment protests that roiled the territory in 2019. It also builds on a national security law for the city that Beijing enacted last summer, giving the authorities sweeping powers to target dissent.

Collectively, those efforts are transforming Hong Kong’s freewheeling, often messy partial democracy into a political system more closely resembling mainland China’s authoritarian system, which demands almost total obedience.

“In our country where socialist democracy is practiced, political dissent is allowed, but there is a red line here,” Xia Baolong, China’s director of Hong Kong and Macau affairs, said on Monday in a strongly worded speech that outlined Beijing’s intentions. “It must not be allowed to damage the fundamental system of the country — that is, damage the leadership of the Communist Party of China.”

The central government wants Hong Kong to be run by “patriots,” Mr. Xia said, and will not let the Hong Kong government rewrite the territory’s laws, as previously expected, but will do so itself.