HONG KONG — Thousands of people, candles in hand, gathered at a park and other locations across Hong Kong on Thursday to commemorate China's massacre of pro-democracy protesters in Beijing's Tiananmen Square 31 years ago, defying the city's first ban on the vigil, ostensibly over the coronavirus pandemic.

Shouting pro-democracy slogans, protesters drowned out warnings that gatherings of more than eight are illegal in the park and ignored nearby police.

“This has been a difficult period for Hong Kong, and I really fear that this will be the last year we can mark June 4 in any way here,” said Crystal Chan, a 22-year-old student who also said she was moved to attend for the first time. Chants of “Fight for freedom, stand with Hong Kong” rang out around her. “The message the students were trying to send in 1989 is the same as ours — that is, the desire of freedom.”

The threat to the annual vigil underscores the deterioration of freedoms in Hong Kong as the Chinese Communist Party moves to tighten its hold on the financial hub, notably through a far-reaching law against sedition, subversion and separatism that Beijing plans to implement within weeks.

Here's what led to the 1989 student demonstrations and military crackdown in Beijing. This video was originally produced for the 25th anniversary of the event. (Jason Aldag/The Washington Post)

Beijing loyalists in Hong Kong’s legislature also pushed through a bill Thursday to criminalize disrespect of China’s national anthem. At Victoria Park, protesters played “Glory to Hong Kong,” a song that was born out of last year’s protest movement and is now considered the territory’s de facto anthem.

“The existence of the candlelight vigil has always been a symbol to show that ‘one country, two systems’ still works,” said Lee Cheuk-yan, who chairs the group that organizes the commemoration, referring to the governance model that previously afforded Hong Kong a high degree of autonomy. The ban on the vigil, he said, showed it no longer holds.

“Let’s see if the police dare to stop us,” he told the gathering estimated at more than 10,000, markedly smaller than last year’s crowd of about 200,000. “Let’s see if they want to tell the world that it is game over in Hong Kong even before the national security law” takes effect.

The Victoria Park vigil was peaceful, and police did not attempt to intervene. Authorities did make several arrests, however, in the Mong Kok neighborhood.

China’s crackdown in Beijing on June 4, 1989, followed weeks of demonstrations in the capital and elsewhere as people called for democracy. The Communist Party eventually ordered the military to clear the square, launching an operation in which hundreds, perhaps thousands, of civilians died.

This year’s anniversary comes as Hong Kong is caught in a bitter clash between China and the United States. On Wednesday, Secretary of State Mike Pompeo tweeted a photo of himself meeting with Tiananmen survivors.

On Monday, despite appeals from organizers, Hong Kong police refused to grant permission for the vigil, citing social distancing and public health measures to manage the covid-19 outbreak. Organizers noted, however, that schools have reopened in Hong Kong; subways, supermarkets, bars and restaurants are again packed; and large religious gatherings are permitted as the city has largely contained the virus.

Aside from the health rationale, Beijing’s proxies have signaled that they will no longer tolerate the vigil. Leung Chun-ying, a former Hong Kong chief executive who is now a political adviser to Beijing, has said the event could be banned under the new security law.

Facing a crackdown, organizers of the vigil called on Hong Kongers to light candles wherever they were to honor Tiananmen victims, and they designated gathering points where small groups could hold remembrances. Hundreds turned up at several of the alternative locations across the island, while thousands defied the ban and headed to Victoria Park — which authorities sealed off with metal fences and other barriers. Others also gathered at churches for special prayer services.

Last year’s crowd was especially large, as people both commemorated the 30th anniversary of the massacre and asserted their freedoms amid the looming threat from the mainland.

A few days after last year’s vigil, hundreds of thousands gathered on Hong Kong’s streets to protest an extradition bill that would have allowed suspects to be sent to the mainland. That protest launched eight months of massive demonstrations and sometimes violent unrest. Hong Kong leader Carrie Lam eventually withdrew the bill.

“Every time there’s a crisis in Hong Kong and more suppression, people will turn out,” said vigil organizer Lee, who also co-founded the Hong Kong Alliance in Support of Patriotic Democratic Movements of China.

This year, the gathering at Victoria Park also was marked by new slogans, notably: “Hong Kong independence, the only way out.” Before last year, independence for Hong Kong was a fringe idea; such slogans were heard on Hong Kong’s streets only after the announcement of the impending national security law.

Although the vigil has been dwindling in popularity among the young — some had lost faith in the exercise of singing and lighting candles, while others wanted to disengage from the struggles of the mainland — it has helped to build a culture of political awareness and protest in Hong Kong.

“We fight for the same things as they did [in Tiananmen Square] 31 years ago,” said 24-year-old Hammond Tong. “The Chinese Communist Party has not changed one bit — the oppression, suppression and persecution have only increased. We must not forget, nor can we stop fighting.” He said he regretted that he had not previously attended the vigil, having been dissuaded by conservative parents and the distractions of daily life.

In the past year, fearing persecution, a growing number of Hong Kong people have moved to democratic Taiwan.

At Liberty Plaza in Taipei, Taiwan’s capital, hundreds attended a candlelight vigil and chanted Hong Kong protest slogans in Cantonese, while lawmakers and Hong Kong students spoke at a smaller event at National Taiwan University.

Chen Kuan-chen, a student at National Taiwan University, said she took pride in Taiwan’s societal support of Hong Kong’s democracy movement and its commitment to commemorating the Tiananmen Square massacre.

“If they cannot talk about this, there are still some people caring about this,” she said. “We are holding the memory for them here.”

On Thursday, Taiwanese President Tsai Ing-wen said on Twitter that she hoped China would openly confront the Tiananmen Square bloodshed in the same way Taiwan has brought to light the atrocities of the island’s decades-long period of martial law.

“In Taiwan, there were once days missing from our calendar, but we’ve worked to bring them to life,” Tsai wrote. “I hope one day China can say the same.”

The Hong Kong clampdown has upset survivors and others affected by the massacre who continue to push for China’s leaders to acknowledge the event, as well as others who came to Hong Kong from the mainland hoping to escape the Communist Party’s rule.

Zhang Xianling, part of the Tiananmen Mothers group, women whose children were killed in the square in 1989, said in a YouTube video that she felt deeply sorry about the ban on the Hong Kong vigil but hoped that people would find ways to mourn the victims and condemn the Communist Party’s “savage acts.”

Among those heeding the call for remembrance was Cheng Yu-Ching, 57, who fled mainland China for Hong Kong just before the Tiananmen massacre and intends never to return. Her father, a landlord, was killed in China’s land reform movement in the 1950s under Mao Zedong, she said.

“Today is a very special day for me, and all Hong Kong people,” Cheng said. She said she would watch an online vigil at home and light a candle. “Mourning does not have to be limited by a specific form, or whether we can gather together, but is something that is felt in our hearts.”

Tiffany Liang in Hong Kong and Nick Aspinwall in Taipei contributed to this report.