Tesla chief executive Elon Musk agreed on Saturday to pay a $20 million fine and step down as board chairman as part of a settlement with the Securities & Commission that he misled investors about his plans to take the company private.

Tesla will separately pay another $20 million and agreed to add two new independent directors to its board. Under the settlement, Musk will resign as chairman of the automaker within 45 days and be barred from that position for three years.

The deal marks a quick resolution to a potentially devastating case for Musk. The SEC sued him on Thursday alleging he lied when he tweeted this summer that he had secured funding to take Tesla private. The agency saw his dismissal as Tesla CEO and sent Tesla’s stock plummeting.

Musk had stunned global financial markets on Aug. 7 when he issued tweets saying he had the “funding secured” to take his automaker private. But federal securities regulators say his statement was deceptive because the deal was in its infancy and sued.

“The total package of remedies and relief announced today are specifically designed to address the misconduct at issue by strengthening Tesla’s corporate governance and oversight to protect investors,” Stephanie Avakian, co-director of the SEC’s Enforcement Division, said in a statement.