Tesla and its CEO Elon Musk have agreed to pay a total of $40 million and make a series of concessions to settle a government lawsuit alleging Musk duped investors with misleading statements about a proposed buyout of the company. The securities fraud agreement, disclosed by the U.S. 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 SEC on Thursday charged Musk, 47, with misleading investors with tweets on Aug. 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 ensuring 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 behavior, which included smoking marijuana and wielding a sword 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 Corp. Tesla must appoint an independent chairman, 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 our investors, including the shareholders of Tesla,” SEC Chairman Jay Clayton said in a statement. Thursday’s charges shaved about $7 billion off high-flying Tesla, knocking its market value to $45.2 billion on Friday, below General Motors Co’s $47.5 billion. 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, who rates Tesla “neutral” and who called the SEC’s penalty “a slap on the wrist” for Musk. “The fact that he can remain CEO is very important for the company.” Neither Musk nor Tesla admitted or denied the SEC’s findings as part of the settlement, which still must be approved by a court. Tesla and Musk 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 – much as another Silicon Valley chief executive, Steve Jobs, did at Apple Inc. The entrepreneur is now required to step down as chairman of Tesla within 45 days, and he is not permitted to be re-elected to the post for three Thursday that the SEC’s actions were unjustified. Tesla shares jumped after his Aug. 7 tweets, a blow to short-sellers betting on the stock’s decline.