The chief scientist at Google’s cloud computing unit is leaving following dustups over a Pentagon contract and her moves to expand artificial intelligence research into China.

In internal emails, Fei-Fei Li had praised “Project Maven,” a contract in which it was supplying the Pentagon with AI-powered image recognition software — and warned colleagues to keep it secret for fear of a media uproar over “weaponized AI.”

“This is red meat to the media to find all ways to damage Google,” Li wrote in an email that was obtained by the New York Times.

Google, a unit of Alphabet Inc., said in early June it wouldn’t renew Project Maven next year after employees protested the deal.

The China-born Li also attracted controversy among employees and US politicians as she led Google’s move to open a research lab for artificial intelligence in Beijing.

Li is returning to Stanford University, where she was a professor before joining Google in 2016, but will remain an advisor to the company, Diane Greene, chief executive of Google’s cloud unit, said in a statement.

Andrew Moore, a computer science professor at Carnegie Mellon University in Pittsburgh, will become head of AI at Google Cloud at the end of 2018, the company said.