The tweet went out at dinnertime on the West Coast, local time for Tesla Motors and SpaceX CEO Elon Musk.

"Payload will be my midnight cherry Tesla Roadster playing Space Oddity," Musk's tweet read. "Destination is Mars orbit. Will be in deep space for a billion years or so if it doesn't blow up on ascent."

Musk is going to launch his personal Tesla Roadster into space on the first SpaceX Falcon Heavy rocket. But why? Is he even serious? Can he do that?

Replying to a follower the next day, Musk wrote, "I love the thought of a car drifting apparently endlessly through space and perhaps being discovered by an alien race millions of years in the future." A few days later, he told another follower it would have a copy of Douglas Adams' The Hitchhiker's Guide to the Galaxy in the glove box, along with a towel and a sign reading, "Don't panic." Surely, it was all a joke. Funny guy, that Elon.

Three weeks later, just before Christmas, Musk took to Instagram this time with a photo of the car in a space capsule and an explanation.

"A Red Car for the Red Planet

"Test flights of new rockets usually contain mass simulators in the form of concrete or steel blocks. That seemed extremely boring. Of course, anything boring is terrible, especially companies, so we decided to send something unusual, something that made us feel. The payload will be an original Tesla Roadster, playing Space Oddity, on a billion year elliptic Mars orbit."

He wasn't kidding.

It shouldn't have been as much of a surprise as it was, though. Way back in March, Musk replied to a follower asking about the payload: "Silliest thing we can imagine! Secret payload of 1st Dragon flight was a giant wheel of cheese. Inspired by a friend & Monty Python."

How did he end up deciding to launch his car into space, though? SpaceX employees with knowledge of the scheme spoke to Motor Trend on the condition of anonymity to share the story behind the "Red Car for the Red Planet."

Late in the summer of 2017, the delayed launch of the first Falcon Heavy rocket was finally beginning to take shape, and it was time to talk payload. As Musk would later tweet, payloads on test flights are generally cheap, heavy objects to simulate a real payload without the risk of losing a billion-dollar satellite if the test went wrong, which isn't uncommon. The engineers tasked with selecting and preparing a payload were aware of the wheel of cheese and Musk's expressed desire to do something silly, so they brainstormed various unexpected payloads. One suggestion: a car. Practical heads prevailed, and the goofy suggestions were shot down in favor of the standard heavy block payload.

The presentation to Musk did not go as planned. The payload team assumed, incorrectly, that Musk would be fine with a typical test payload on such an important launch. That's not Musk's style. He wanted a fun payload and sent the team away to come up with one. They came back with their old list of goofy ideas, and Musk loved the car idea. He immediately offered up his personal 2010 Tesla Roadster Sport.

See all 2 photos

A few weeks later, the car rolled into a SpaceX workshop to be prepped for spaceflight, and the real work began. Things launched into space first must survive the launch, which as you can imagine is both loud and violent. Like all payloads, the Roadster needed to undergo sonic, vibration, vacuum, and other standard testing to make sure that it wouldn't come apart during the launch and ascent and damage the rocket and that it would survive in space.

It was quickly determined the car needed to be stripped. After all, the only launch it was designed for was a stoplight drag. All the glass had to go, as did the battery. With the battery out, there was no need to keep the drivetrain in, either, so that went, too. Musk himself has been very open about prototype rockets tending to explode, and no one wants to scatter 1,000 pounds of lithium across the upper atmosphere. Other than the obvious weak points like glass, SpaceX engineers were impressed with the rigidity and durability of the Lotus-based Roadster in their tests.

The car was still in the test lab when Musk's first tweet went out. It took the team by surprise, as the whole thing had been a big secret up until that point and was supposed to remain so until the launch. The tweet, followed by the photo confirmation on Instagram a few weeks later, unleashed a torrent of regulatory inquiries from regulators, including the Federal Aviation Administration (FAA).

Any rocket launched into space from a U.S. territory must be licensed by the FAA, and part of that license includes approving the cargo it will carry. Generally, the rules require the regulator to determine if the cargo is a threat to human health and safety to the safety of U.S. property. It also must be in compliance with international space treaties. Stripped of its potentially hazardous components, the Roadster should pass muster, but according to reports, FAA wasn't happy about the surprise.

In the broader regulatory scope, the international Outer Space Treaty only covers planetary protection, designed to prevent other planets from being contaminated with any sort of life from Earth (such as hardy microbes that could hitch a ride on a spacecraft). Were the Roadster to land on Mars or if it were put in orbit of the planet where it could eventually be pulled down by gravity, SpaceX would be in violation. To get around that, the Roadster will be sent out to the general distance from the sun where Mars orbits and left to drift, never coming close enough to the planet to risk crash landing. Otherwise, legal experts mostly agree there isn't really any law preventing SpaceX from sending the Roadster into space.