Elon Musk, billionaire and chief executive officer of Tesla Motors, who also leads SpaceX. (Krisztian Bocsi/Bloomberg News)

The future of Tesla may be imperiled by a Securities and Exchange Commission lawsuit that seeks to oust Elon Musk, the chief executive. But SpaceX, one of Musk’s other companies, has continued to garner support from its key customers, especially NASA, which can’t afford to see one of its main suppliers falter.

SpaceX has become vital to NASA’s operations and is also a key supplier to the Pentagon. The government has invested billions of dollars in SpaceX and relies on it to send science experts and cargo to the International Space Station, and to launch national security satellites used in modern warfare. By next year, SpaceX is poised to fly NASA’s most valuable assets — its astronauts — to space.

While once it was a scrappy start-up that clawed and sued its way into the federal market, now it is a major federal contractor that is vital to the government’s space program. While Musk is chief executive (and “lead designer”), others at the company are in charge of day-to-day operations.

“There’s no alternative at this point to using a commercial company,” said Carissa Christensen, the chief executive officer of Bryce Space and Technology, a consulting firm. “NASA cannot magic up its own vehicle. It doesn’t have one.”

On Thursday, the SEC sued Musk and sought to ban him from leading any public company (SpaceX is private). The agency alleged that Musk lied to investors when he announced on Twitter over the summer that he had the funding secured to take Tesla private. That followed months of erratic behavior, including smoking marijuana on a live broadcast and, without evidence, calling one of the Thai cave rescue divers a pedophile.

While all of that could prove to be devastating to Musk, SpaceX has continued to charge ahead. And its clients have stood by it.

In a statement, NASA spokesman Bob Jacobs said the contracts the agency has awarded are to the company — not the man. And Jacobs said that NASA is “focused on successful commercial cargo and crewed missions to the International Space Station. Our contracts are with SpaceX and other commercial spaceflight companies. We expect our commercial partners to meet all legal and safety requirements in the execution of the services they provide.”

Since bursting onto the launch market, SpaceX has disrupted the commercial industry as well, lowering prices for commercial satellite operators, and in 2017 it restored the United States as the leader in the number of launches worldwide for the first time in more than a decade.

Christensen said she didn’t think Tesla’s woes would affect SpaceX. The company flew 18 times successfully last year, more than its competitors, and achieved 34 successful launches in a row. It is on track to launch as many as 24 times this year. Its low prices and track record have earned praise and trust — even though it had two rockets blow up in recent years.

“There is certainly a lot of support on the military side, on the civil side and from a national standpoint,” Christensen said.

But there are factions at NASA that have long been concerned about relying on the private sector for such important missions, in general — and about SpaceX, in particular. Musk’s recent behavior could fuel those doubts.

“I guarantee you there are high levels of concern, especially in the astronaut office,” said a former high-ranking NASA official, who spoke on the condition of anonymity to talk frankly about the agency. “The company they are relying on is this guy. They’ve always viewed with him with a lot of concern. I have to believe that’s even more now.”

At SpaceX, employees are trying to focus on their work. While once they celebrated Musk’s brash tactics and unfiltered style — calling out competitors, even suing the government — the latest behavior is “obviously more serious” and “bothersome” to many at SpaceX, the person said.

Those working on the line “put it out of their mind; they ignore it,” said another person familiar with the company, who spoke on the condition of anonymity to be candid about SpaceX. “They don’t acknowledge it, at least publicly. It’s not spoken about. We’re not talking about that; we’re focused on building rockets and going to Mars.”

Though he founded SpaceX in 2002, Musk is not as integral to running the company on a day-to-day basis as he once was. That is done by Gwynne Shotwell, the company’s president and chief operating officer, who was one of Musk’s very first hires.

Shotwell has “basically been doing CEO duties,” the person familiar with SpaceX said. “SpaceX is at the point where Elon hasn’t been necessarily on the day-to-day operations side for quite some time. His role has been to be the long-term visionary, strategist and designer.”

One of SpaceX’s key clients is Iridium, which has hired it to launch its new constellation of satellites. The company “is very comfortable with our relationship with SpaceX,” Matt Desch, Iridium’s chief executive, said. He added that “we don’t deal with Elon on day-to-day matters relating to satellite launches to space. That’s all Gwynne Shotwell. And Gwynne is totally in command of what’s going on there.”

Even though they are run by the same man, and lots of SpaceX employees drive Teslas to work, the companies are in different cities and are “really functionally separate,” the person said. “The only bridge has been Elon. And they’re not reliant on each other for financial operation [or research and development] purposes at all. And that was by design.”