Washington/San Francisco — Tesla and Elon Musk have agreed to pay $20m each to financial regulators and the billionaire will step down as the company’s chair but remain as CEO, under a settlement that caps a tumultuous two months for the carmaker.

The securities fraud agreement, disclosed by the US Securities and Exchange Commission on Saturday, will come as a relief to investors, who had worried that a lengthy legal fight would only further hurt the loss-making electric car company.

The commission on Thursday charged Musk, 47, with misleading investors with tweets on August 7 that said he was considering taking Tesla private at $420 a share and had secured funding. The tweets had no basis in fact, and the ensuing market chaos hurt investors, it claimed.

Investors and corporate governance experts said the agreement could strengthen Tesla, which has been bruised by Musk’s recent behaviour, which included smoking marijuana on a webcast and attacking a British rescue diver via Twitter.

The settlement should place more oversight on Musk while not taking the “devastating” measure of forcing him out, said Steven Heim, a director at Boston Common Asset Management, which owns shares in Tesla battery maker Panasonic.

Tesla must appoint an independent chair, two independent directors and a board committee to set controls over Musk’s communications under the proposed agreement.

“The prompt resolution of this matter on the agreed terms is in the best interests of our markets and investors, including the shareholders of Tesla,” said Securities and Exchange Commission chair Jay Clayton.

Thursday’s charges shaved about $7bn off high-flying Tesla, knocking its market value to $45.2bn on Friday.

In the settlement, the agency pulled back from its demand that Musk, who is synonymous with the Tesla brand, be barred from running Tesla, a sanction that many investors said would be disastrous.

“I think this is the best possible outcome for everyone involved” said Ivan Feinseth of Tigress Financial Partners.

Neither Musk nor Tesla admitted or denied the commission’s findings as part of the settlement, which still must be approved by a court. They did not immediately respond to requests for comment.

Musk had been directly involved in almost every detail of Tesla’s product design and technology strategy, and drove the company’s employees to extraordinary achievements. He is required to step down as chair of Tesla within 45 days, and is not permitted to be re-elected to the post for three years.

The Securities and Exchange Commission charged Tesla with failing to have required disclosure controls and procedures for Musk’s tweets. It said the company had no way to determine if his tweets contained information that must be disclosed in corporate filings, or if they contained complete and accurate information.

Musk walked away at the last minute from an earlier settlement with the commission that would have required him to give up key leadership roles at the company for two years and pay a nominal fine, according to media reports on Friday.

Investors said it has been a mistake for Musk to turn down that settlement, especially at a time when the company has been pushing hard to meet aggressive production targets for its Model 3 sedan.

The settlement tasks the Tesla board with the tricky challenge of finding an independent chair able to work closely with the CEO. “The question is whether Musk’s buddies on the board decide to bring in a strong chair who will stand up to him,” said Erik Gordon, a University of Michigan business professor.

Musk has driven the company to the verge of profitability with a costly ramp-up of production of its Model 3 over the past year. Electric-vehicle news site Electrek reported that Tesla had produced 51,000 Model 3s with a couple of days left in the quarter, hitting its goal of 50,000 to 55,000.

As the public face of Tesla, Musk has gained legions of fans for his bold approach to business and technology. He used his Twitter account to promote the achievements of Tesla, his rocket launch company SpaceX and his tunnel venture, the Boring Co, to his nearly 23-million followers.