While it remains off limits for people in China, official media outlets like the Communist Party-controlled People’s Daily newspaper and the Xinhua news agency have used Twitter to shape perceptions of the country in the rest of the world.

“On the one hand, state media takes advantage of the full features of these platforms to reach millions of people,” said Sarah Cook, a senior analyst for East Asia at Freedom House, a pro-democracy research group based in the United States. “On the other hand, ordinary Chinese are risking interrogation and jail for using these same platforms to communicate with each other and the outside world.”

LinkedIn, the business networking service and one of the few American social media outlets allowed in China, has long bowed to the country’s censors. It briefly took down the Chinese accounts of Peter Humphrey, a British private investigator who was once imprisoned in China, last month and Zhou Fengsuo, a human-rights activist, this month. The company sent emails to both containing language similar to the messages it sends users when it removes posts that violate censorship rules.

“What we’ve seen in recent weeks is the authorities desperately escalating the censorship of social media,” Mr. Humphrey said. “I think it’s quite astonishing that on this cloak-and-dagger basis, LinkedIn has been gagging people and preventing their comments from being seen in China.”

Both accounts have been restored. In a statement, LinkedIn apologized for taking the accounts down and said it had done so by accident. “Our Trust and Safety team is updating our internal processes to help prevent an error like this from happening again,” the statement said.

Image Peter Humphrey, a private investigator who was once jailed in China. LinkedIn, the business networking site, briefly took down his Chinese account last month. Credit... Frank Augstein/Associated Press

With Twitter, Chinese officials are targeting a vibrant platform for Chinese activists.

Interviews with nine Twitter users questioned by the police and a review of a recording of a four-hour interrogation found a similar pattern: The police would produce printouts of tweets and advise users to delete either the specific messages or their entire accounts. Officers would often complain about posts that were critical of the Chinese government or that specifically mentioned Mr. Xi.