HONG KONG — The Hong Kong government used a colonial-era public security ordinance to ban a small pro-independence political party on Monday, a move rights advocates said would threaten free expression and association in the city.

The Hong Kong National Party has just a handful of members and no elected representatives, but it attracted intense government scrutiny for its call to make Hong Kong, a former British colony that rejoined China in 1997, an independent state.

The decision to ban the party was announced in a published notice in the Hong Kong government gazette. John Lee, the secretary for security, said in July that the authorities were considering outlawing the group, and had solicited its response.

“I cannot ignore the fact that the Hong Kong National Party has repeatedly advocated that it will use all methods, including the use of force, and also encouraging its supporters to use force,” Mr. Lee said Monday. He said the party had promoted hatred and discrimination toward mainland Chinese in Hong Kong.

The decision to ban the party was made “in the interest of national security, public safety, public order and the protection of rights and freedoms of others,” Mr. Lee added.

The head of the party, Andy Chan, was banned from running for office in Hong Kong two years ago after he refused to answer an election officer’s questions over whether he would push for independence.

Mr. Chan spoke at the Foreign Correspondents’ Club of Hong Kong in August, saying the efforts to ban his party were a sign of deteriorating freedoms in the city. “The nature of China is oppression,” he said, adding that the only way to achieve true freedom was as an independent state. But he added that his party condemned the use of violence.

He also complained about the influx of people from the mainland, which he said was diluting Hong Kong’s culture.

China’s foreign ministry and local officials criticized the club for hosting a speaker who advocates separatism, and a former Hong Kong leader said the government should reconsider the lease of the group’s clubhouse in a historic, public-owned building.

Mr. Chan declined to comment Monday on the ban. He issued a reply to the authorities on Sept. 14, nearly four hours after an official deadline had passed.

The law under which the party has been banned, the Societies Ordinance, has not been used against a political party since Hong Kong returned to China’s control in 1997. During the colonial era, political parties like the Communist Party of China and the Kuomintang, Taiwan’s former ruling party, were outlawed in Hong Kong.

Under the law, a person who claims to be an officeholder of a banned party could be imprisoned for up to three years, and a member could be imprisoned for up to one year, or two years for a subsequent offense. Anyone who allows a banned group to meet in their house or building could also be imprisoned for up to a year for a first offense.

While now part of China, Hong Kong has more robust protections for civil liberties under what is known as “one country, two systems.” But human rights groups say that the outlawing of a political party has diminished Hong Kong’s status as a bastion for individual freedoms within China.

“The banning of the Hong Kong National Party is a milestone in the Beijing and Hong Kong governments’ assault on Hong Kong’s freedoms,” Maya Wang, a senior researcher for Human Rights Watch, said in a statement.

“The ban violates a range of human rights guaranteed to Hong Kong people, including the rights to freedom of association and assembly,” she added.

The Societies Ordinance, which authorizes the prohibition of groups for reasons of national security, public safety and public order, has largely been used against organized crime.

While the Hong Kong National Party is a tiny organization, the government’s effort to ban it has been protested by a broad swath of pro-democracy figures who said the move would lead to further restrictions on political freedoms.

Opinion surveys indicate most people in Hong Kong do not support the city’s independence from China. But the idea has been widely discussed, particularly after the 2014 Umbrella Movement, when protesters occupied city streets for 79 days to push for more open elections.

A survey last year by the Chinese University of Hong Kong found that 11.4 percent of respondents supported Hong Kong independence. Other studies of university students have indicated stronger support for an independent Hong Kong.

The government in Beijing and Hong Kong officials have condemned such calls. Some pro-government lawmakers and mainland officials have said the talk of secession shows that Hong Kong needs to pass comprehensive national security legislation that would outlaw treason, secession, subversion and other such acts.

That law, known as Article 23, was last proposed by the Hong Kong government in 2003, but it was shelved after huge protests. Carrie Lam, the Hong Kong chief executive, has said the time is not right to pursue such legislation again.