Elon Musk, the chief executive of the US electric carmaker Tesla, has denied that the vehicles are used for spying in China.

His comments came after reports of China's military banning Tesla cars from its facilities emerged. The military cited concern about the data collected by cameras installed in the vehicles.

Musk said if a business was involved in spying on a foreign government, "the negative effects for that company would be extremely bad," reported BBC.

"There's a very strong incentive for us to be very confidential with any information. If Tesla used cars to spy in China or anywhere, we will get shut down," Musk said during a Chinese business forum.

China is important for Tesla as it's the largest market after the U.S.

Meanwhile, Musk was recently called out by U.S. Senator Bernie Sanders for being "immoral" because of his wealth.

Sanders tweeted, "We are in a moment in American history where two guys — Elon Musk and Jeff Bezos — own more wealth than the bottom 40% of people in this country. That level of greed and inequality is not only immoral. It is unsustainable."

In response to the criticism, Musk said, "I am accumulating resources to help make life multiplanetary & extend the light of consciousness to the stars."

Elon Musk James Bond 007 Lotus Esprit Elon Musk plans to build his very own electric Lotus Esprit working submarine! RM Auctions