Intelligent robots and computers intent on destroying mankind may sound like science fiction to most of us.

But to Elon Musk it's a real threat. That's why he's donating millions to ensure that Artificial Intelligence technology remains safe for humanity.

Musk, the founder of both Tesla Motors (TSLA) and SpaceX, has long expressed concern about the threat he fears smart machines and computers could pose to human civilization. In remarks at the Massachusetts Institute of Technology last fall he called AI "our biggest existential threat," and said that with advances humans are "summoning the demon."

Related: Tesla's Chinese sales hit a rough patch

Thursday he backed that rhetoric with cash, donating $10 million to the Future of Life Institute, to fund research aimed at keeping AI beneficial for humanity. The Future of Life Institute is a think tank that is focused on the threats posed by advances in Artificial Intelligence.

Musk does not deny that AI has the potential to greatly improve the condition of mankind, both by eliminating humans from having to perform work he describes as "drudgery" or by enabling breakthroughs in scientific areas that are currently beyond human intelligence. But he's also worried that AI could lead to catastrophic outcomes if humans are not able to control or stop actions by intelligent machines.

"This is a case where...the range of negative outcomes, some of them are quite severe," Musk said on a video clip posted on the Institute's site. "It's not clear whether we'd be able to recover from some of these negative outcomes."

Related: Musk warns against unleashing AI 'demon'

Some of those who founded the group are researchers in the field of AI and they said they welcomed Musk's donation.

"This will provide the impetus to jump-start research on AI safety", said Tom Dietterich, president of the Association for the Advancement of Artificial Intelligence.

Musk announced the gift in a tweet Thursday morning, in which he glibly wrote, "It's all fun & games until someone loses an I."