By Austin Ramzy

HONG KONG — The Hong Kong government said on Thursday that candidates for the legislature must acknowledge the semiautonomous city as an “inalienable part” of China and faced possible criminal penalties if they did not uphold the pledge.

Some scholars and lawmakers said the announcement, made days before nominations open for a legislative election in September, could harm political freedoms guaranteed under Hong Kong law.

Hong Kong, a former British colony that returned to Chinese control in 1997, maintains much of its own legal and economic system. But after 2047, that model of “one country, two systems” will expire, and many worry it is already eroding under increasing pressure from mainland China.

In recent years, supporters of independence or greater autonomy from China have grown increasingly vocal. Some candidates in the September elections have expressed support for those ideals or at least for allowing the public to vote on the future status of Hong Kong.

Legislative Council members have previously had to pledge allegiance to Hong Kong and swear they will uphold the Basic Law, which serves as a constitution regulating the territory and outlining its relations with China’s central government. Under the requirements announced on Thursday, candidates will have to sign such an oath in order to run.

“We take the view that advocating and promoting ‘independence of Hong Kong’ is contrary to the content of the declaration that the law requires a candidate to make,” the government said in a written statement. Requiring the declaration before the vote was driven by “uncertainties to the solemn Legislative Council election and confusion to electors,” it said.

The Election Affairs Commission said in a separate statement that anyone “making a false declaration in the nomination form is liable to criminal sanction.”

The Progressive Lawyers Group, an association of pro-democracy barristers, solicitors and students in Hong Kong, said it was concerned that a requirement to sign such a pledge “could be a first step towards a capricious use of such statutory declarations in different contexts to achieve political ends.”

A handful of candidates aligned with what is known as a localist movement could win office in the fall. Given the low popularity of Hong Kong’s top political official, Leung Chun-ying, the chief executive, the government’s effort to clamp down on nativism could increase its acceptance, said Willy Lam, a professor at the Chinese University of Hong Kong.

“Most opinion polls show only a small minority of people in Hong Kong support separatism,” Mr. Lam said, noting that the new requirement could actually hurt the government. He added: “People will think it’s an overreaction, a knee-jerk reaction from Beijing. This kind of paranoia about localists blossoming into full-fledged separatist political activities might be counterproductive.”

The movement is still relatively on the political fringe but gained support after the Umbrella Movement in 2014, when protesters occupied major roadways for weeks to push for a more open system of nominating candidates for chief executive.

After a riot in February in the district of Mong Kok, a Chinese official said the upheaval was the work of “radical separatists.” And at least one localist protester, Edward Leung, embraced that label. He won 15 percent of the vote in a February by-election for an open Legislative Council seat despite having been charged in connection with the riot. Mr. Leung, who advocates independence as a member of the group Hong Kong Indigenous, said on Friday that he was consulting with his lawyers about whether to sign the pledge.

The pro-independence Hong Kong National Party said it would sign the pledge, calling the requirement a “self-deceptive” attempt by the government to curb the rise of the independence movement in Hong Kong.

“Even if this party signs the declaration, it would continue advocating and promoting independence for Hong Kong,” the party said in a statement on Facebook.

Alan Wong contributed reporting.

Article originally appeared in The New York Times on 15 July 2016.