Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

SpaceX's billionaire founder, Elon Musk, has a plan for putting humanity on Mars, and he's helping usher in a new age of SolarCity electricity and Tesla electric cars — but even he is worried about the potential for a "Terminator"-style robot apocalypse.

"There are some scary outcomes, and we should try to make sure the outcomes are good, not bad," Musk said on Tuesday during a CNBC interview.

Sign up for Science news delivered to your inbox

SpaceX's Elon Musk worries that not even the new Dragon V2 spaceship can provide an escape from a "Terminator"-style robot apocalypse. SpaceX

Get breaking news and insider analysis on the rapidly changing world of media and technology right to your inbox. This site is protected by recaptcha

Not even Mars would be safe.

"The A.I. would chase us there pretty quickly," he said.

The subject came up in the context of Musk's recent investment in an artificial-intelligence company called Vicarious, and his past investment in another A.I. company called DeepMind (which was acquired by Google).

"It's not from the standpoint of actually trying to make any investment return," the 42-year-old serial entrepreneur explained. "It's really, I like to just keep an eye on what's going on with artificial intelligence. I think there is a potentially dangerous outcome there."

Musk referred to the plot thread in the "Terminator" movies, where (SPOILER ALERT!) increasingly intelligent and malevolent robots take over the world. "They didn't expect some sort of 'Terminator'-like outcome," he said. "It is sort of like the 'Monty Python' thing: 'Nobody expects the Spanish Inquisition.'"

Musk's concerns mesh with the worries raised a decade ago by Sun Microsystems' Bill Joy, as well as the projection by Google's in-house futurist, Ray Kurzweil, who says computers will match human intelligence by 2029. Musk had no prescription for managing the rise of A.I., other than to say "you have to be careful."

He also said he's leaving the field open for others to follow up on his proposal for a high-speed tube network called the Hyperloop, at least for now.

"I understand that there are some companies that are forming to try to make the Hyperloop happen," he said. "I encourage them. I think that's great. I'm super-focused on Tesla and SpaceX and a small amount on SolarCity. So that basically completely uses up my brain. But I hope something happens with the Hyperloop. And if nothing happens with it, then I will probably do something down the road to try to make it happen."

Unless the robots beat him to it.

For the full rundown, check out CNBC's transcript of the Musk interview and this story focusing on his comments about Tesla Motors, SpaceX and Mars.