Last month, NASA said it would pay SpaceX its largest single contract ever, $2.6 billion, to shuttle U.S. astronauts up to the International Space Station (ISS). It’s one of two companies that will build vehicles to replace the discontinued space shuttle and return the U.S. to the list of spacefaring nations. The other, SpaceX’s frequently testy competitor Boeing, will do the same job but at more than half again the cost—some $4.2 billion.

In fact, SpaceX has a chance at beating the aerospace giant to be the first private company to fly humans onto orbit. This is an enormous milestone for the firm, and also its most dangerous task so far. But building cost-effective space vehicles gives SpaceX a chance to save U.S. space efforts from their own torpor.

Despite successes in planetary science, like the Curiosity rover on Mars, NASA’s manned space program has been floundering. The first plan to replace the space shuttle was cancelled; a new effort to send people to explore the solar system is behind schedule and over budget, to the pointwhere it may be unfeasible. Even the basic effort of getting astronauts up to the ISS—real estate in which the U.S. has invested $75 billion—has been outsourced to Russia.

In the private sector, the U.S., once the leader in satellite launches, now lags behind European and Russian competitors. An existing joint venture between Lockheed Martin and Boeing, the United Launch Alliance (ULA), is using engines bought from a Russian state company until 2017. And as China and India show their prowess to catch-up to the advanced economies with cost-consciousspace stations and Mars probes of their own, a U.S. side-bet on commercial space companies has now become the most likely way for the U.S. to get off the ground.

When NASA officials first got involved with SpaceX eight years ago, they thought they were hiring a temp worker for scut work—a so-called “space taxi” while the government focused on higher aims. But now the commercial project may be NASA’s best hope for getting humans into space.

* * *

When Elon Musk founded SpaceX in 2002, it was, at best, a millionaire’s flight of fancy. He had made his fortune from tech startups Zip2 and PayPal, and was still two years away from starting Tesla, the electric-car firm.

Musk, as he will gladly tell you, has a vision: Colonize Mars and make humans a multi-planet civilization. He sees it as insurance against a global catastrophe that leads to human extinction. Per Musk, the only sensible policy in this universe is redundancy. Newly wealthy and with time on his hands, he concocted a scheme to send a greenhouse full of plants to Mars as a kind of grand gesture, but couldn’t find any cost-effective rocket to send it there, even on a multi-millionaire’s budget.

He did find people like Tom Mueller, a frustrated engineer at the conglomerate TRW’s aerospace division, who was building a rocket engine for fun in his garage. That—the largest liquid-fueled engine ever built by an an amateur—turned out to be the earliest version of the Merlin, which powers SpaceX’s rockets. Musk also met Hans Koenigsmann, a German engineer who became the company’s fourth technical employee, at a rocketry club launch in the Mojave desert. “My German accent helps in presentations,” Koenigsmann says. “When I say, ‘This will work,’ it is more convincing than other accents for some reason.”