HONG KONG — In an operation that spanned more than 12 hours, Hong Kong police on Monday arrested media tycoon and activist Jimmy Lai, his sons and at least seven others and raided his newsroom under a sweeping national security law that China recently imposed on Hong Kong.

Those swept up included Agnes Chow, a 23-year-old activist who rose to prominence alongside Joshua Wong and Nathan Law as a student protester in 2014. Police said that most of those arrested were suspected of colluding with foreign powers, a crime punishable by life in prison.

Taken together, the dramatic events quashed any doubt that Beijing would use the national security law as a mere deterrent and underscored the increasingly precarious plight of pro-democracy activists and journalists in Hong Kong. Lai, 71, and Chow are the most prominent of those arrested under the law to date.

Just after dawn, officers arrived at Lai’s home and that of his sons to question and arrest them. Four other senior executives at Lai’s media group, Next Digital, were also arrested, according to the company and Mark Simon, a close aide to Lai. Next Digital is the parent company of Apple Daily, a pro-democracy news outlet critical of Beijing that Lai founded in 1995.

Shortly afterward, more than 200 police entered Next Digital’s offices, according to the company’s Facebook page and a live stream of the raid, and searched Apple Daily’s newsroom. They rifled through reporters’ desks and papers, told employees to show identification cards and warned journalists to stop filming and photographing the raid. By the end of the operation, police had seized 25 boxes of material.

Under Hong Kong’s Basic Law, its mini-constitution, freedom of the press is protected. Police said they took care to protect media freedoms amid Monday’s operation. The Hong Kong Police Force held several news conferences to provide updates Monday but barred some reporters from attending and did not allow those present to ask questions. Apple Daily reporters, officers said, could “continue their work” after the operation.

Apple Daily said in a statement that it strongly condemned the operation and accused police of abusing their power.

“Hong Kong’s press freedom is now hanging by a thread, but our staff will remain fully committed to our duty to defend the freedom of the press,” the statement added.

The U.S. Treasury Department last week imposed sanctions on Hong Kong Chief Executive Carrie Lam and 10 other officials, including Beijing’s envoy in the city, the police commissioner and his predecessor, for eviscerating political freedoms in Hong Kong. The city’s government called the sanctions “shameless and despicable” and said it would support Chinese countermeasures.

“I have expected this day would come, but I did not expect it to come at this moment, after the U.S. sanctions,” said a journalist at Apple Daily, speaking on the condition of anonymity for fear of reprisals. “These arrests are about revenge. They are targeting us, a media outlet which is the most outspoken against the Hong Kong government and Beijing.”

A senior journalist at Apple Daily, also requesting anonymity for safety reasons, added that the arrest of Lai was “just the first step.”

“Shutting down Apple Daily and threatening other media organizations is the goal — so that no one dares to speak the truth at the end,” the person said.

Apple Daily is among Hong Kong’s most-read media outlets, and Next Digital employs thousands of staffers. Several Next Digital executives were among those arrested Monday.

Shares of Next Digital slumped briefly after Monday’s arrests. But supporters of Hong Kong’s democracy movement quickly heeded calls on social media to buy the company’s stock, sending Next Digital soaring by 300 percent at one point — and in the process coining another form of protest.

Beijing has branded Hong Kong’s pro-democracy movement a Western plot to undermine the ruling Chinese Communist Party, rather than a genuine call by Hong Kong people for greater freedoms and the preservation of the territory’s promised autonomy in the face of Beijing’s encroachment. Beijing’s Hong Kong and Macao Affairs Office praised the arrest and said those harming national security must be “severely punished.”

The new security law imposes maximum sentences of life in prison for offenses such as subverting state power, advocating for Hong Kong’s independence, terrorism and colluding with foreign forces. It grants authorities wide-ranging powers to search premises and electronic devices and seize servers, including from media organizations.

Hong Kong’s media industry had been bracing for the impact since the law took effect July 1. The city has long been a regional base for the Asian operations of outlets including the New York Times and the Wall Street Journal.

Last month, the New York Times said it would move some operations to Seoul, citing uncertainty and fears over the new law. Media organizations recently have faced delays in renewing visas for Hong Kong-based journalists, with little clarity from the government.

An officer at Hong Kong’s immigration department, speaking on the condition of anonymity to discuss a sensitive issue, said a new national security unit has been established in the department to review visa applications that officials consider contentious.

Although the security law is not supposed to apply retroactively, it has been designed to stifle dissent and target Beijing’s opponents. Lai is part of what Chinese state media dubs a “Gang of Four,” comprising supporters of democracy in the Chinese territory. He has been arrested before, most recently in February on charges of illegal assembly and intimidation amid a broader sweep against pro-democracy campaigners.

The self-made millionaire is particularly grating to Beijing because of his long-standing relationships on Capitol Hill. Lai traveled to Washington last year to meet with Vice President Pence, Secretary of State Mike Pompeo and House Speaker Nancy Pelosi (D-Calif.). Chinese state media have called Lai a traitor and accused him of bankrolling pro-democracy causes. Lai, who is from mainland China, became politically active after Beijing’s 1989 crackdown on protesters at Tiananmen Square.

This is the second time authorities have used the security law to directly target activists and arrest them at their homes. Last month, police arrested four people between the ages of 16 and 21 under the law for their alleged roles in a student group that advocates for Hong Kong’s independence. The law was also used against demonstrators at a street protest on July 1.

Beijing has long used family members to apply pressure to political dissidents and activists. In an interview in June marking the 25th anniversary of Apple Daily, Lai said his activism is his responsibility alone and that he did not want his family to be involved.

During a Facebook live chat four days ago, Lai was asked about Chinese state media reports that arrest warrants had been issued for activists outside Hong Kong and whether he believed such threats were legitimate.

“I think this is only the beginning. I think they will continue to censor people they consider detrimental to the [Chinese Communist Party’s] international standing,” Lai replied.

Tiffany Liang, Ryan Ho Kilpatrick and Timothy McLaughlin contributed to this report.