“I’m like an old auntie jabbering on, always promoting democracy and repeating its benefits,” he wrote in an article in 2014. “Dictatorship is always torn down in one night, but good democracy isn’t built in one night.”

Critics say that even as he cast himself as an independent voice, Dr. Yang went out of his way to soothe the Chinese government. Before his detention in January, he spent two years with his family in New York, where he was a visiting scholar at Columbia University.

He was detained in January after arriving in Guangzhou, China, on a flight from New York. Officials say his family has not been allowed to visit in the months he has been held.

At a news conference in Beijing on Tuesday, Geng Shuang, a spokesman for the Chinese Ministry of Foreign Affairs, confirmed that Mr. Yang had been formally arrested on suspicion of spying. He also warned Australia not to get involved.

“China is a country of rule of law,” Mr. Geng said. “Australia should truly respect Chinese legal sovereignty, and not in any way meddle in China’s handling of the case according to the law.”

Friends and scholars familiar with Dr. Yang’s work expressed outrage at his formal arrest.

“This case reeks of politics, and political payback,” said Richard McGregor, a senior fellow with the Lowy Institute and former China correspondent. “Yang is someone who has been able to come and go from China despite his relationship with the dissident community. It is very difficult to see how he suddenly fits the profile of a spy.”

Feng Chongyi, a China scholar who was Dr. Yang’s Ph.D. adviser at the University of Technology, Sydney, said he was saddened by the charges, but not surprised.

“Communist China continues to show its ugly face to the world,” he said. “I hope Australia, Canada, the U.S. and other democracies around the world will form a strong coalition to deal with this monster.”