A tiny and previously little-known political party with no presence in the legislature would have languished on the fringes of Hong Kong’s political sphere were it not for attempts by the city’s government to crush the group.

Now, the Hong Kong National Party finds itself in the limelight, raised to an unaccustomed level of prominence in a dispute that is fast becoming a test for the city’s autonomy.

The party calls for Hong Kong’s independence from China, which has had sovereignty over the former British colony since the 1997 handover.

“What we want to say is this: We are not China,” said Andy Chan, the founder of the party. “We are Hong Kong. We are advocating for Hong Kong nationalism, and in doing this, we may make [the Hong Kong and Chinese governments] feel uneasy.”

Under the principle of “one country, two systems,” the city operates as a semiautonomous Chinese territory with political freedoms and civil rights unheard of on the mainland. However, many residents fear that those freedoms are quickly being eroded by Beijing’s increasing encroachment.

Although growing numbers of young Hong Kongers are said to support independence,the party has had little traction in its two years of existence.

But in recent weeks, the party has been thrust to center stage as Hong Kong and Chinese authorities threatened to ban it and sought to prevent its founder from giving a public talk. A previously inconsequential political group is now embroiled in a saga that may set momentous legal precedents for the city.

“Why are they so heavy-handed and using a sledgehammer to crack a walnut?” said Jason Y. Ng, a columnist and member of the Progressive Lawyers Group, a Hong Kong organization that promotes democracy and the rule of law.

Answering his own question, he suggests several reasons for the government’s tactics:

One possibility is that the Chinese government “is concerned about Hong Kong being used as an incubator for political dissent . . . so they need to do something to nip the movement in the bud.”

But a more plausible reason, he said, might be that the authorities want to “test the temperature of the public to see how they would react to legislation being enacted based on national security grounds.”

When the Hong Kong government’s security bureau threatened last month to outlaw the National Party, the agency argued that this was “necessary in the interests of national security.”

The ban would be enforced under Hong Kong’s societies ordinance, a colonial-era law that authorizes the prohibition of groups on grounds of national security, public safety and public order. Banning the party under the law, which is typically used to fight organized criminal groups, would be the first use of the ordinance against a political party since the 1997 handover. The party has until Sept. 4 to argue its case.

The use of the societies ordinance, Ng said, is part of a roundabout attempt by the government to resurrect notorious security legislation, known as Article 23, that requires the city to enact modern laws against treason, sedition and subversion. A previous attempt to implement Article 23 in 2003 met huge public backlash, drawing hundreds of thousands onto the streets in protest.

Mathew Wong, a professor at the University of Hong Kong who studies the city’s politics, thinks such a move would be unlikely to encounter a backlash this time.

“Based on my observations on previous events, the lack of social challenge on these actions is very clear now,” Wong said. “I don’t think it will backfire.”

Escalating the conflict, China’s Ministry of Foreign Affairs has directly intervened in the matter, urging the Foreign Correspondents’ Club of Hong Kong to cancel a lunch talk Tuesday by Chan, the founder of the party.

The Foreign Correspondents’ Club insists it will hold the event as planned. “We believe that in free societies such as Hong Kong it is vitally important to allow people to speak and debate freely, even if one does not agree with their particular views,” the club’s board of governors said in a statement on Monday.

Wong thinks the authorities are using the incident to flex demonstrate their power and establish a precedent.

“I think it is clear that they want to set an example,” he said in an email. “They don’t mind giving the party or the incident international attention; in a sense I think they want to. From past experience . . . the social backlash is minimal. There is little downside for demonstrating their strength.”

And by picking an obscure party with a divisive pro-independence stance, the government has managed to isolate the group, Ng said.

“At this point, any pro-independence group is politically radioactive, so not a lot of people are willing to stand by in solidarity with them,” he said.

Meanwhile, current and former high-ranking government figures have weighed in personally. Carrie Lam, the city’s top official, has slammed the luncheon talk as “regrettable” and “inappropriate.”

Lam’s predecessor as chief executive of Hong Kong, Leung Chun-ying — now a vice chairman of a top advisory body to the Chinese government — has explicitly targeted the Foreign Correspondents’ Club in his criticism, writing in a Facebook post that the event has “nothing to do with press freedom.” In a separate post, he compared inviting Chan to “inviting terrorists to teach aircraft hijacking.”

“By inviting Andy Chan, the FCC has crossed the line,” Leung wrote in yet another post , noting that the club’s statement did “not rule out inviting secessionists from Taiwan, Tibet and Xinjiang as their guest speakers.”

This is not the first time that the Hong Kong and Chinese governments have clamped down on relatively unknown figures.

Earlier this year, Benny Tai, a law professor at the University of Hong Kong, was publicly rebuked by senior Hong Kong and Chinese officials for suggesting that the city could become an independent state. The People’s Daily, the newspaper of mainland China’s Communist Party, called on the Hong Kong government to take legal action against Tai for his comments.

To rights activists, the high-profile and seemingly coordinated attacks against Tai were a sign of Beijing’s efforts to further restrict civil liberties in Hong Kong.