Two months after Tesla Inc. (TSLA) CEO Elon Musk faced allegations of misleading investors with a single tweet, the issue has finally been legally resolved. U.S. District Judge Alison Nathan allowed Musk and the Securities and Exchange Commission (SEC) to settle the dispute with a total of $40 million in fines, Bloomberg reported Tuesday.

Musk and Tesla will each pay $20 million to the SEC. Musk agreed to a settlement with the federal agency at the end of September after the SEC filed a lawsuit alleging wrongdoing on Musk’s part. Per the terms of the settlement, he will also step down from Tesla’s board but will remain CEO.

On Aug. 7, Musk tweeted that he wanted to take Tesla private at $420 per share, infamously claiming he had already secured funding to do so. Tesla shares jumped significantly afterward, but the “funding secured” part of the tweet made it legally dubious. The SEC accused him of misleading investors, as he had not actually gotten the funding he had promised.

There was never much concern that the settlement would be rejected in court, but Musk briefly generated more controversy before Nathan’s decision was made. He mocked the SEC on Twitter in early October, causing Tesla shares to drop by 7 percent. Still, the settlement was approved, and Musk will personally lose $20 million.

Tesla has yet to name a new chairman to replace Musk. Early reports indicated it would be former News Corp. CEO James Murdoch, but Musk disputed those claims.

GettyImages-479833756 Elon Musk's settlement with the SEC was approved. Elon Musk, CEO and CTO of SpaceX, CEO and product architect of Tesla Motors, and chairman of SolarCity, attends the Allen & Company Sun Valley Conference on July 7, 2015 in Sun Valley, Idaho. Photo: Scott Olson/Getty Images

With the take-private situation settled, Tesla continues to seek profitability. The electric car manufacturer has operated at a loss until now, but both Musk and some analysts seem to believe that could change in the near future.

Tesla struggled with production problems in manufacturing its Model 3 vehicle earlier this year, but the company’s third-quarter production report indicated those have largely been fixed.

Shares of Tesla gained 6.55 percent on Tuesday.