SHANGHAI — Three days before the most sensitive political anniversary on the Chinese calendar, Twitter suspended the accounts of Chinese political commentators in what it said was an accident. The move showed starkly the global political ramifications of Silicon Valley slip-ups.

Twitter’s action, which one human rights worker said affected more than 100 users, came over several hours late Friday and early Saturday. It hit human rights lawyers, activists, college students and nationalists, who use workarounds to get access to Twitter, which is banned in China. Just about every part of the raucous, if small, Chinese language Twitter world was affected.

The accounts began rapidly disappearing just days before the 30th anniversary of the crackdown on a student-led pro-democracy demonstration in Tiananmen Square in Beijing. Many online assumed the worst: a coordinated attack by Beijing to project its suffocating internet censorship outside its own digital borders. Senator Marco Rubio, a Florida Republican, tweeted about his concern.

Yet the culprit was not Chinese censors but Twitter’s own overactive filters.

In a statement, Twitter said that as a part of its routine efforts to stop spam and inauthentic behavior, it had inadvertently gone after a number of legitimate Chinese-language accounts.

“These accounts were not mass reported by the Chinese authorities — this was routine action on our part,” the company said in a statement on Twitter. “Sometimes our routine actions catch false positives or we make errors. We apologize.”

Online, many users said they did not believe Twitter’s statement told the whole story. One human rights lawyer, whose account had been taken down, said that in protest he tweeted an image of Twitter’s bird mascot colored red with five yellow stars to evoke the Chinese flag.

The routine action set off real fears. In China, the June 4 anniversary of Tiananmen brings an extra dose of censorship to one of the world’s most controlled corners of the internet. Tools that help users jump the Great Firewall to get access to the broader online world often sputter inexplicably.

Within China, Twitter users have faced escalating pressures. At the end of 2018, China’s Ministry of Public Security began to target Chinese Twitter users. Although Twitter is blocked, many use virtual-private network software that enables access.

In a campaign carried out across the country and coordinated by a division known as the internet police, local officers detained Twitter users and forced them to delete their tweets, which often included years of online discussion, and then the accounts themselves. The campaign is continuing, according to human rights groups.

Twitter said that all users in China who had their accounts recently suspended should be able to recover them, though a day later, some accounts remained locked, according to Yaxue Cao, editor of ChinaChange.org, a website dedicated to writings on civil society and human rights.

“I do believe Twitter is trying to do good,” Ms. Cao said. “No questions about that. But the results are mixed.”