Saudi Arabia’s sovereign wealth fund is investing $1 billion into Lucid Motors, capital that will finance the commercial launch of the startup’s first electric vehicle.

The agreement comes just six weeks after Tesla CEO Elon Musk tweeted that he was considering taking Tesla private at $420 a share and had secured the proper funding to make the leap. Musk suggested that Saudi’s wealth fund, which already owns almost 5 percent of Tesla stock, was interested in backing the company’s move from public to private.

Tesla’s board and Musk have since quashed those plans to go private.

The investment came at a crucial moment for Lucid Motors, which has struggled recently to raise the funds needed to produce its luxury EV, the Lucid Air. The funding will be used to complete engineering development and testing of the Lucid Air, construct its factory in Casa Grande, Arizona, begin the global rollout of its retail strategy starting in North America and enter production, the company said.

Lucid Motors was founded 10 years ago with a different name and mission. The company, called Atieva at the time, was focused on developing electric car battery technology. It then shifted to producing electric cars and changed its name in 2016.

The company seemed to have momentum at the time. Lucid Motors had successfully raised money, unveiled the Air, announced plans to build a $700 million factory in Arizona, signed a deal with Samsung SDI to supply it with lithium-ion batteries and moved into spacious new digs. But building a factory is expensive, and the company fell silent for nearly a year as it sought funding to produce the Air.

It’s also a notable investment for the Saudi kingdom, which under its Vision 2030 plan is seeking to diversify its economy away from fossil fuels. In the past year, the Saudi Public Investment Fund has invested in renewable energy, established and developed recycling companies and energy efficiency services, the kingdom noted in a release.