A friend of mine from Taiwan was guest lecturing earlier this year at a university in Shanghai. As he was trying out the equipment in a classroom the day before his first lecture, a loud voice came seemingly out of nowhere, chastising him for leaving the machine on after his test.

He scanned the room. There was nobody there. He then saw surveillance cameras and speakers on the walls — a chilling reminder that he would be teaching under the watchful eye of school authorities.

This professor’s experience offers a glimpse into the changing academic environment in China, where authorities combine Mao-era human spying practices with new surveillance technology to ferret out outspoken professors and students who fail to follow Communist Party ideology.

As China’s economic woes threaten to undermine President Xi Jinping’s authority, the government has intensified its political control on campuses. In Mr. Xi’s words, universities should become “party strongholds.”

Over the past decade, many Western educators and researchers have seen China as an attractive destination. And Beijing has invested heavily in its elite educational institutions, allowing them to refurbish or expand their campuses in prime urban spots, and building towering new classroom and lab buildings and lush gardens. The amount of money that Chinese researchers have received has skyrocketed.

Such lavish spending by Beijing has prompted many Western private universities — like New York University, Duke University and the University of Sydney — to set up ventures there.

Behind this glamorous facade lurks an increasingly elaborate surveillance network and a repressive political atmosphere. Many new classrooms are equipped with closed-circuit cameras through which authorities monitor students and professors to make sure that Western values, or comments that are critical of the Chinese government, do not seep into classrooms. Since last year, most of the top-tier universities have set up special departments to supervise “the ideological and political work” of their teaching staff.

Another friend — a professor in China’s southeastern province of Zhejiang — told me that instructors there are required to fill out forms to pledge that they abide by the party rules. Universities also assign and pay students to spy on teachers and other students, and to report any statements that contravene the official party line. Those who are found violating the “ethical” guidelines could face demotion or outright dismissal.

For the Taiwanese professor, detecting the hidden cameras before his lectures enabled him to exercise caution and spared him the trouble that befell several Chinese professors in recent years.

To cite just a couple of many recent examples: In August, the Chinese police broke into the home of a retired professor, Sun Wenguang, in the eastern province of Shandong, while he was in the middle of a live phone interview with the Voice of America and criticized China’s spending abroad. The police abruptly yanked him off the air and took him away. Mr. Sun then disappeared. In July, there were reports that a university in the southeastern city of Xiamen fired a veteran professor of international trade and economics for making what university officials vaguely described as “radical” statements in class.

The current political environment reminds me of my school days in the Mao era — when we were encouraged to report our teachers and fellow students, subjecting people to brutal denunciation and physical attacks for alleged Western “bourgeois” thinking. Nowadays, the government deprives teachers of their livelihood if they stray, making it impossible for them to find a job elsewhere.

Since Mr. Xi took power in 2012, the government has practically eliminated dissent or independent thinking on university campuses. Teachers are living in fear, and most have chosen to remain compliant, resorting to self-censorship in exchange for job security and personal safety. Researchers now find ludicrous ways to link their projects with the Xi Jinping ruling philosophy to shield themselves from funding cuts. The fact that thousands of students are flocking to Western universities each year illustrates the lack of confidence in the Chinese educational system.

Higher education is instrumental in building China’s global status, and a large pool of university graduates will contribute to China’s continued economic boom. But intensified ideological controls on academia will stifle creativity and critical thinking.

The suppression of creativity in China breeds plagiarism, which runs rampant on Chinese campuses. Moreover, with encouragement from the Chinese government, scientists and researchers have made stealing Western intellectual property a shortcut in China’s rise to power.

When Western leaders confront China over its intellectual property rights violations during trade talks, it is important to pressure Chinese leaders to make academic freedom a mandatory condition for trade. A little outside pressure is the only hope for change.

Zhang Lun is a professor of Chinese studies at the Université de Cergy-Pontoise in Paris. This essay was translated by The New York Times from the Chinese.