HALIFAX, Nova Scotia (AP) — The top U.S. military officer said Saturday that it's problematic that American tech companies don't want to work with the Pentagon but are willing to engage with the Chinese.

U.S. Chairman of the Joint Chiefs of Staff Joseph Dunford told the Halifax International Security Forum that the U.S. and its allies are the "good guys."

"I have a hard time with companies that are working very hard to engage in the market inside China... then don't want to work with the U.S. military," he said. "I just have a simple expression: "We are the good guys."

Earlier this year, thousands signed a petition asking Google's chief executive to cancel Project Maven, which provides the Pentagon with the company's artificially intelligent algorithms to interpret video images and improve the targeting of drone strikes.

Google later said it would scuttle the project, according to published reports.

Dunford avoided mentioning Google by name, but said companies that share intellectual property with Chinese entrepreneurs are essentially sharing it with the Chinese military.

Google is reportedly worked on a mobile version of its search engine that will comply with strict censorship controls in China.

"This is not about doing something that's unethical, illegal or immoral," he said. "This is about ensuring that we collectively can defend the values for which we stand. That would be the argument I make to the tech companies."

Dunford said the U.S has had a competitive advantage since World War II because of public and private cooperation and noted that whoever masters artificial intelligence will have an edge in combat.

The Halifax International Security Forum attracts U.S military officials, senators, diplomats and scholars and is marking its tenth anniversary this year.

At the forum, a stirring video tribute was played of late Sen. John McCain.

McCain was a regular at the forum and his wife, Cindy, presented an award Saturday in his honor to the people of Lesbos, Greece for their work welcoming refugees.

"We've lost his voice now at a time when it was most needed," Cindy McCain said. "It's up to us, now."