When Hollywood wanted to bring to life Tony Stark, the comic-book engineering prodigy who grew up to be the billionaire industrialist and slick playboy alter ego of Iron Man, it turned to the closest thing the real world seemed to offer.
"We need to sit down with Elon Musk," Robert Downey Jr, who plays Stark in the blockbuster film series, told his colleagues. Jon Favreau, the director, hailed Musk as "a Renaissance man in an era that needs them".
He lacks - for now - the superhero's jet-powered suit of armour. But in the 12 years since making his fortune from the sale of PayPal, the online payments firm, Musk has become a man whose vast wealth, wild ambitions and turbulent personal life are scarcely less cartoonish. Next month, the buccaneering, South African-born entrepreneur, renowned for his pledge to colonise Mars one day, is expected to travel to London. He is due to hand over the keys to the first buyers of the British version of the Model S, the 70,000 ($137,800) electric car on which Tesla, Musk's futuristic car manufacturer, is pinning its hopes.
The buzz surrounding its arrival has environmentalists longing for the sharp reduction in carbon emissions that could come from a long-awaited mainstream breakthrough in sales of electric cars. Only 1547 were sold in Britain between January and April this year - 0.18 per cent of the total. Having been eagerly snapped up by film stars, musicians and the doyens of Silicon Valley over the past two years, the Model S has become California's third highest-selling luxury car. Its growing popularity followed a string of triumphs by SpaceX, another of Musk's ventures, in its mission to dominate the commercial space exploration industry. Yet sceptics could be forgiven for wanting to kick the tyres of some of the 42-year-old tycoon's more audacious claims.
From his days in Pretoria as a skinny kid nicknamed Muskrat, bullied by bigger boys, Musk was always different. He took refuge in his fantasy books, encyclopedias and computers. At the age of 12, he sold his first piece of software, a simple video game set in space called Blastar.
After his parents divorced when he was 8, Musk lived with his father, an electrical engineer. Life propelled him towards another country. "My father was very strict," his sister, Tosca, once said. "While everybody in South Africa had maids and servants, he'd have us play this game. It was called America, America, and when we played it, we'd have to do everything an American child would do. We'd have to clean the house, mow the lawn, do all sorts of American chores."
At 17, Musk returned to the Canadian roots of his mother, a model and nutritionist, by moving to live with relatives in Ontario. Studying physics and economics at Ontario's Queen's University, Musk finally secured his move across the border to the US in 1992, with a transfer to the University of Pennsylvania. Despite not drinking, he made money hosting boozy parties for fellow students. After graduating, he headed to the west coast to work toward a PhD at Stanford, the birthplace of Google and several other pioneering technology firms. Within days, however, he dropped out. Impatient to dive into business, Musk founded a scrappy startup with his brother.
Sleeping in their office and taking showers at a YMCA, they built Zip2, an early online platform for newspapers. In February 1999, at the height of the dotcom boom, they sold up for more than US$300 million ($351.2 million) to Compaq, the computing firm. Musk never looked back. He parlayed his share of the fee into a firm that became PayPal, then made an estimated US$160 million when eBay bought the payments company for US$1.5 billion in 2002.
By then, Musk had American citizenship and a wife, Justine Wilson, a fantasy novelist he had met at university. As they danced at their wedding reception, Musk reportedly told his bride: "I'm the alpha in this relationship." The naturally dark-haired writer later said: "No matter how many highlights I got, Elon pushed me to be blonder. 'Go platinum', he kept saying, and I kept refusing."
After one dispute, she said, he told her: "If you were my employee, I would fire you."
The couple's first child, Nevada, died suddenly at 10 weeks. Justine later complained that Musk refused to grieve. "He was very much in the mode of stiff-upper-lip, the-show-must-go-on, let's-get-it-over-with," she once said. "He doesn't do well in the dark places." Following IVF treatment, Justine later gave birth to the couple's five boys, one set of triplets and one of twins.
But after eight years, she had had enough. The pair separated in a messy, multimillion-dollar divorce. Six weeks later, Justine claimed, Musk texted her to say he was engaged to "a gorgeous British actress in her early 20s". Talulah Riley, 14 years his junior, became Musk's wife in 2010. Despite turbulent times, they remain together. But, as Justine once put it: "Elon's central relationship is with his work."
After his PayPal windfall, Musk ploughed his energy and money into his triply quixotic venture of conquering space, cracking the electric car and - with his third company, Solar City - dominating the installation of home solar power. He is said to work 80-hour weeks, shuttling between meetings at his different California headquarters and not taking notes.
The road has been rough. Musk has admitted he badly underestimated how difficult and expensive it would be to establish a car manufacturer. Around the time of the breakdown of his marriage, his businesses were battered by the economic meltdown and he was almost wiped out. "Personal bankruptcy was a daily conversation," his brother told an interviewer. "He threw everything he had into keeping Tesla alive." Aided by a US$465 million loan from the US Government, which also began giving hefty tax rebates to American Tesla customers for buying green cars, the firm turned a corner.
While still making multimillion-dollar annual losses and remaining mired in legal challenges about its sales practices from traditional dealerships, the firm is now valued at around US$25 billion. As its biggest shareholder, Musk's fortune is estimated at more than $8 billion.
SpaceX has also come a long way since its first craft repeatedly failed to take off at high-profile launch events. By 2012, 10 years after its formation, it had become the first private firm successfully to launch into orbit and bring back a spacecraft, and to send one to the International Space Station (ISS). It has gone on to win hundreds of millions of dollars in contracts from the US Government to build rockets and run ISS supply missions, amid a decline in spending on Nasa. Solar City is the second biggest solar equipment provider in America.
Musk has grown into his role as an international tycoon. His clothes are more tailored than in the PayPal days and he says vaguely enigmatic things such as: "The first step is to establish that something is possible - then probability will occur." Yet rather than nobly enjoy the plaudits for his achievements, Musk has frequently misstepped with Branson-esque boasts about how much more he will do and how quickly. In 2009, for example, he said that by this year, SpaceX would be ferrying tourists back and forth from space for millions of dollars a time. Not quite.
In addition, his skin sometimes appears a little thin. Last year, he entered a furious dispute with the New York Times after a writer said that the battery on his Model S drained so quickly on a test drive that he ended up needing to be towed to a charging station. Musk went on the offensive, aggressively tweeting and blogging with data recovered from the writer's car about the route he had taken to challenge his account.
Five "super-charging" stations, which Musk claims will allow Tesla's British customers a drive of up to 500km, are reportedly being set up outside London, on the south coast, and near Bath, Birmingham and Manchester. Tesla executives are claiming that they will help cure any remaining "range anxiety" preventing drivers from abandoning their petrol cars.
Musk, however, seems more interested in his ultimate prize: sending humans to Mars. "Ultimately," he once said, "the thing that is super-important in the grand scale of history is, are we on a path to becoming a multi-planet species or not? If we're not, well, that's not a very bright future." In 2012, he predicted that he would be transporting people to the Red Planet "in roughly 12 to 15 years". Since then, he has said it will be more like 20. Announcing last week that he had made "some progress", Musk struck an unusually cautious note. "Hopefully," he said, "it will happen before I'm dead."
Born: June 28, 1971, in Pretoria, South Africa, to a Canadian mother and a South African father. He taught himself coding and software, and had designed and sold a video game, Blastar, by the age of 12. He graduated from Pretoria Boys High School and moved to Canada at 17. He studied at the University of Pennsylvania and began a PhD at Stanford but left after only two days. Twice married, he has five children.
Best of times: He made his mark by co-founding PayPal, which transformed e-commerce, in 1999. He sold it three years later to eBay for US$1.5 billion ($1.76 billion). Last year, he published plans for Hyperloop, a public transport system to shuttle passengers between Los Angeles and San Francisco at 1290km/h. He is now CEO and chief designer of SpaceX, which manufactures and launches rockets and spacecraft.
Worst of times: His first child, Nevada Alexander, died aged 10 weeks.
What he says: "I don't create companies for the sake of creating companies, but to get things done."
What others say: "Arguably the greatest innovator of his generation, the serial entrepreneur Elon Musk is always one step ahead of the rest."