BEIJING — An encrypted messaging app said Thursday that it was hit by a powerful cyberattack from China as a major protest unfolded in Hong Kong.

The attack on the Telegram app, which slowed connectivity but did not compromise user data, came as thousands surrounded Hong Kong government headquarters on Wednesday to protest legislation that would allow people to be extradited to mainland China to stand trial. The protesters were forcibly dispersed by police using tear gas, pepper spray and rubber bullets. They did not assemble again on Thursday and debate over the legislation was delayed.

Telegram CEO Pavel Durov tweeted that most of the attackers had IP addresses from China.

"Historically, all state actor-sized (attacks) we experienced coincided in time with protests in Hong Kong," Durov said. "This case was not an exception."

Activists in both Hong Kong and mainland China often use Telegram to organize protests in hopes the encryption will allow them to evade the government surveillance of Chinese social networking apps such as WeChat.

Whereas WeChat users reported this week that photos of the protests could not be viewed, apps like Telegram offer more privacy and independence. Telegram is blocked in mainland China, but users can access it using software to circumvent the firewall, which also blocks apps and websites ranging from Facebook to The New York Times.

Encrypted messaging apps such as Telegram say that messages sent on their systems cannot be decoded by third parties during the delivery from sender to recipient. "We can ensure that no single government or block of like-minded countries can intrude on people's privacy and freedom of expression," Telegram says on its website.

Telegram said that the latest attack was a distributed denial of service in which "your servers get GADZILLIONS of garbage requests which stop them from processing legitimate requests."

The messaging app said on Wednesday evening that the system had stabilized.

The protest in Hong Kong forced the legislature to cancel its sessions Wednesday and Thursday, putting off debate on the extradition legislation.

Opponents say the bill would severely compromise their freedoms and erode Hong Kong's legal independence. Hong Kong leader Carrie Lam maintains the legislation is necessary and would have safeguards to ensure human rights are protected.

Hong Kong, a semi-autonomous Chinese territory, enjoys greater freedoms than mainland China under a "one country, two systems" framework put in place when the former British colony was returned to China in 1997. Hong Kong residents can freely surf the internet and participate in public protests, unlike in the mainland.

The U.S. government has complained for years about data breaches by China to steal high-tech information and other trade secrets — a key factor in the current trade dispute between China and the United States. Pentagon leaders told a congressional committee this month that cyberattacks from China are increasingly sophisticated.

When asked about the Telegram issue at a daily news briefing, Chinese foreign ministry spokesman Geng Shuang said he was not aware of the case but that "China always opposes any form of cyberattack."

"China is also a victim of cyberattacks," Geng said.