Elon Musk’s rocket-building company SpaceX and Jeffrey P. Bezos’s similar Blue Origin have grabbed the headlines in the space race. But there is a fascinating backstory about how the private space industry came into being. It is the tale of a renegade entrepreneur, Peter Diamandis, who founded the XPrize Foundation to encourage rocket-building in order to find a way into space himself.

Journalist Julian Guthrie tells the story in a new book, “How to Make a Spaceship: A Band of Renegades, an Epic Race, and the Birth of Private Spaceflight” (Penguin, Sept. 20, 2016). It reads like a thriller — and reveals many secrets. (Full disclosure, Diamandis recruited me in 2011 to be head of academics at a futuristic think tank.)

I have no doubt that the lessons in the book will resonate with today’s entrepreneurs, engineers and innovators because they illustrate how the impossible can be made possible. And, in a few years’ time, shopping for spaceflight tickets without understanding the background of the private space race is like carrying an iPhone without knowing it started with a desktop computer or flying in a plane with no idea that it started with the Wright Flyer in 1903.

As Guthrie narrates the story, and as I have heard from Diamandis on several occasions, it all started with the Apollo 11 moon landing in July 1969. After watching the historical landing, Diamandis became determined to fly into space himself and organized his life around that dream. He completed two degrees from MIT and a medical degree from Harvard — not to practice medicine but to enhance his chances of getting into the Astronaut Corps.

Then he founded a national student space club, which Bezos was chapter head of at Princeton; an international space university; and a rocket company. When NASA began to wind down manned space flight, Diamandis realized the government wouldn’t get him where he wanted to go and that he would have to do it on his own.

He found his inspiration for a modern-day space race in the golden age of aviation, when French hotelier Raymond Orteig offered a $25,000 prize to the first person to fly nonstop between New York and Paris. Several unsuccessful attempts had been made before an American airmail pilot named Charles Lindbergh won the competition in 1927 and galvanized the creation of the commercial airline industry. Nine teams competed for the $25,000. Between them, they spent around $400,000 — 16 times the value of the cash prize. Diamandis marveled: “Orteig didn’t spend one cent backing the losers. By using incentives, he automatically backed the winner … great return on his money.”

In May 1996, Diamandis launched a $10 million prize for the first nongovernmental team to build and fly a manned rocket to space twice within two weeks. When the XPrize was announced, only three nations — the United States, Russia and China — had launched men into space. The XPrize soon had 24 teams from more than a dozen countries competing. Across the globe, engineering students scraped together money and resources to try to build a manned space program. Space scientists ignored ribbing from colleagues who said the dream of private space travel was impossible. Retirees working in rice fields in Texas built engines and rockets. A famous game programmer named John Carmack (now the chief technology officer of Oculus Rift) decided to try to do for aerospace what he had done for video games.

And in the Mojave Desert, an airplane designer named Burt Rutan, who had secretly attracted funding from a billionaire — Microsoft co-founder Paul Allen — began his covert space program with fewer than 30 engineers working on the spaceship.

Rutan began with foam models thrown off the Mojave tower, created with designs doodled on a napkin. With every new type of plane, Burt plotted and planned and worked out hundreds of details in his mind before testing with a computer. There was never an epiphany, a single “aha” moment, only iteration after iteration, layer after layer. How these foam models led to the world’s first private spaceship, SpaceShipOne, is one of the great entrepreneurial adventure stories of our time.

Rutan won the $10 million XPrize in 2004. Businessman and investor Richard Branson bought the rights to the technology and is developing SpaceShipTwo to fly paying passengers to the edge of space. Musk, who met Diamandis in the spring of 2001 and was inspired by the XPrize, has hit one milestone after another and hopes to take NASA astronauts to space beginning next year. Bezos, who met with Diamandis in the early days of the XPrize, is also making history with his own suborbital spacecraft. (Bezos owns The Washington Post.)

The story sounds incredible, as if torn from the pages of science fiction. And it has a happy ending. But as with all entrepreneurial ventures, nothing went according to plan: It was riddled with failure and disappointment; ugly battles broke out between friends and founders; the world often looked like it was coming to an end; and Diamandis had to gamble everything he had.

Most interesting was an observation that Branson made in the book’s foreword: There isn’t much of a difference between being an adventurer and an entrepreneur. As an entrepreneur, you push the limits and try to protect the downside. As an adventurer, you push the limits, and protect the downside — which can be your life.