Artificial intelligence could spur the creation of a robot dictator that could rule mankind forever, the billionaire Elon Musk says in a new documentary.

"If one company or small group of people manages to develop god-like superintelligence, they could take over the world," Musk said in the film.

He continued: "At least when there's an evil dictator, that human is going to die. But for an AI, there will be no death — it would live forever. And then you would have an immortal dictator from which we could never escape."

He's basically saying governments or other entities could create a dangerous AI that could outlive human leaders and never be destroyed — and that one way to avoid this is to democratize AI.

The documentary "Do You Trust This Computer?" presents a sobering look at the potential dangers of AI, including what could happen if AI evolves to be smarter than humans and becomes its own master.

He added: "We have five years. I think digital superintelligence will happen in my lifetime, 100%."

The problem with a superintelligent AI is that, should it become smarter than humans, we could lose control of the technology. The film posits that if the AI has a goal, it might try to achieve it in a way that humans might not agree with, but there would be no way to stop it.

"AI doesn't have to be evil to destroy humanity — if AI has a goal and humanity just happens in the way, it will destroy humanity as a matter of course without even thinking about it, no hard feelings," Musk said. "It's just like if we're building a road and an anthill happens to be in the way, we don't hate ants, we're just building a road, and so goodbye anthill."

Musk's warning echoes his previous grim predictions about the perilous nature of AI.

Musk tweeted in early September that "competition for AI superiority at a national level" would most likely be the cause of a World War III, and he has said AI is the greatest risk facing civilization.