America’s top two defense officials slammed Google’s work with China on Thursday saying it has “indirectly benefited” Beijing’s military.

“We watch with great concern when industry partners work in China knowing that there is that indirect benefit,” Marine Corps Gen. Joseph Dunford, chairman of the Joint Chiefs of Staff, told members of the Senate Armed Services Committee hearing.

“The work that Google is doing in China is indirectly benefiting the Chinese military,” Dunford said. “The way I describe it to industry partners is, ‘look we’re the good guys and the values that we represent and the system we represent is the one that will allow and has allowed you to thrive,'” he said.

Dunford’s comments come in the wake of the tech giants’ decision not to pursue some of the Pentagon’s lucrative contracts while considering projects in China.

In October, Google said it would no longer compete for the Pentagon’s Joint Enterprise Defense Infrastructure, or JEDI, cloud computing contract, an award that could be worth $10 billion. Google said that the contract may conflict with its corporate values. In addition, the company also said it would not renew a Pentagon contract that analyzed aerial drone imagery for the military.

Meanwhile, it was revealed last year that the tech giant was studying the idea of working with the Chinese government on “Project Dragonfly,” a censored search engine that would block certain sites and search terms. More recently, after pushback from politicians and activists, Google said it had dropped those plans.

But Google Chief Executive Sundar Pichai has said the company will continue to invest in China while also considering projects with the U.S. government.

Acting Secretary of Defense Patrick Shanahan, also speaking before the Senate committee, echoed concerns that China has gamed American innovation.

“$5 trillion of their [China’s] economy is state-owned enterprises. So the technology that has developed in the civil world transfers to the military world, it’s a direct pipeline. Not only is there a transfer, there is systemic theft of U.S. technology that facilitates even faster development of emerging technology,” he said.

“The talent is in this country, we need to use the talent in this country and the talent in this country needs to support our great power competition,” Shanahan added.

The criticism comes as the U.S. trade battle with China marches on, with intellectual property theft proving to be a major sticking point between the world’s two largest economies.

U.S. officials have long complained that intellectual property theft has cost the economy billions of dollars in revenue, thousands of jobs and threatens national security.

“If China successfully captures these emerging industries of the future, America will have no economic future and its national security will be severely compromised,” White House trade advisor Peter Navarro said in June.

For the Pentagon, there is no better example of Navarro’s comments than the most expensive U.S. weapons system: the F-35 Joint Strike Fighter.

On Oct. 26, 2001, the Pentagon awarded Lockheed Martin a contract worth more than $200 billion to build the next-generation stealth strike fighter. As America’s next fighter jet came to life, some of its sensitive design and electronics data were believed to be compromised in 2009.

Chinese hackers were believed to be behind the cyberintrusion since its stealth Shenyang J-31 jet bears a remarkably striking resemblance to the F-35. And before the J-31 mimicked the F-35, there was the curious case of the J-20 and the F-22.

In another instance of alleged industrial espionage, the prototypes of China’s Chengdu J-20 stealth fighter jet looked suspiciously similar to the sleek design of Lockheed’s F-22 Raptor.

While the U.S.-made Lockheed Martin jets are believed to have better computer software, more sophisticated sensors and sensitive stealth coating, the theft of intellectual property gives adversaries the opportunity to avoid the expense and delays involved with research and development.

Last March, President Donald Trump signed an executive memorandum that penalized China for trade practices such as industrial espionage. The measures impose retaliatory tariffs on about $60 billion in Chinese imports.

On hand for the signing was Lockheed Martin CEO Marillyn Hewson, who oversees the F-35 Joint Strike Fighter.

Hewson said intellectual property is the “lifeblood” of the defense industry and welcomed the action taken by the Trump administration.

“This is a very important moment for our country, in that we are addressing a critical area for the aerospace and defense industry and that is protecting our intellectual property,” she said.

Meanwhile, on Wednesday, President Donald Trump said he was in no hurry to come to a trade deal with China and gave no indication of when he would meet with Chinese President Xi Jinping.

“I’m in no rush. I want the deal to be right … I am not in a rush whatsoever. It’s got to be the right deal. It’s got to be a good deal for us and if it’s not, we’re not going to make that deal,” Trump told reporters at the White House.

Trump decided in February that he would not increase tariffs on Chinese goods at the beginning of March.