Elon Musk took to the stage Wednesday night at the Vanity Fair New Establishment Summit to warn attendees that advanced artificial intelligence could spell the end of humanity.

Interviewed by Walter Isaacson, Musk warned of the rapid speed of AI development and the effects it could have:

I don't think anyone realizes how quickly artificial intelligence is advancing. Particularly if [the machine is] involved in recursive self-improvement ... and its utility function is something that's detrimental to humanity, then it will have a very bad effect. 

He went on to muse about just how serious the problem could be.

If its [function] is just something like getting rid of e-mail spam and it determines the best way of getting rid of spam is getting rid of humans ...

Isaacson asked Musk whether humanity could escape killer robots by traveling to Mars using SpaceX ships.

No--more likely than not that if there's some ... apocalypse scenario, it may follow people from Earth.

--This story first appeared on Business Insider.