BEIJING  - China published draft rules on Thursday to ensure the security of data generated by connected vehicles, as the proliferation of smart cars such as Teslas, fuels concerns about privacy and national security.

Last month, U.S. electric car maker Tesla Inc came under scrutiny in China when the military banned its cars from entering its complexes, citing security concerns over vehicle cameras, sources told Reuters at the time. 

Days later, founder Elon Musk appeared by video at a high-level Chinese forum, saying that if Tesla used cars to spy in China or anywhere, it would be shut down. 

The rules released on the website of the National Information Security Standardization Technical Committee would forbid companies from processing data from cars that is not related to vehicle management or driving safety.

Also, data regarding locations, roads, buildings, terrain and other information collected from the environment outside the cars through sensors such as cameras and radar would not be allowed to leave the country, it said.

Automakers have been equipping more vehicles with cameras and sensors to capture images of a car's surroundings. Control of use, sending and storage of these images is a fast-emerging challenge for the industry and regulators worldwide.

Data collected from Tesla electric cars in China is stored in the country, a company executive said this month. 

On Wednesday, top auto industry body the China Association of Automobile Manufacturers (CAAM) said it had launched an auto data storage platform, using blockchain technology, for its members to use for their vehicles.

CAAM also held a policy discussion with China's industry and public security ministries.

Participants included Tesla, Volkswagen AG and Chinese companies such as car makers Geely and Nio Inc and telecom giant Huawei Technologies , the industry body said. 

(Reporting by Beijing newsroom; Editing by Kim Coghill and Clarence Fernandez) ((tony.munroe@thomsonreuters.com))