Elon Musk has been warned by Nasa’s most senior figure not to repeat his weed-smoking, whisky-drinking antics on a recent podcast if he wants to continue working with the space agency.

Jim Bridenstein, the Nasa administrator, suggested that Mr Musk, an entrepreneur who is financing commercial space exploration, had acted inappropriately given his role with the company.

Mr Musk’s SpaceX is one of two firms contracted to build a shuttle that will fly US astronauts to the International Space Station from American territory – something that was ended in 2011.

Recent behavior by Mr Musk, who co-founded the online payment system PayPal and the car company Tesla, has triggered a slew of negative headlines in the media.

In September, Mr Musk inhaled a joint made from marijuana and tobacco while on the podcast Josh Rogan Experience which was filmed in California, where the drug is legal.