(Reuters) - Shares of Tesla Inc TSLA.O jumped by almost 18 percent on Monday as Chief Executive Elon Musk settled a lawsuit that had threatened to force him out and said a surge in third-quarter production had driven it to the verge of profitability.

Tesla fans cheered the signs of a manufacturing jump while business analysts said the company needed to fulfill the spirit of the settlement by appointing a strong independent chair and new directors.

The electric carmaker’s shares sank last week after the U.S. Securities and Exchange Commission accused Musk of securities fraud and sought to ban him from company leadership, pointing to a long drawn-out fight that could have undermined Tesla’s operations and ability to raise capital.

Instead, under a settlement announced at the weekend, Tesla and Musk will pay $20 million each to the regulator and Musk will step down as chairman but stay as CEO, keeping one of America’s best-known corporate figures in place.

In a sign of the manufacturing process improving, Musk in an email to employees on Saturday said the company was “very close to achieving profitability”. He added, “To be certain, we must execute really well tomorrow.” Sunday was the last day of the quarter.

Automotive news website Electrek reported here on Monday that Tesla had produced 53,000 of its Model 3 sedans in the third quarter, up from 28,578 in the previous three months and making good on a promise in August it would produce 50,000 to 55,000 of the cars. It produced about 80,000 vehicles overall, the site said.

Tesla did not immediately respond to a request for comment.

Relief at the settling of the lawsuit drove the biggest one-day gain in Tesla shares in more than five years.

“The stock was down so much on Friday because it was unclear if he would remain with the company at all given what the SEC was pushing for,” said Garrett Nelson from CFRA Research.

FILE PHOTO: Tesla Motors CEO Elon Musk reveals the Tesla Energy Powerwall Home Battery during an event in Hawthorne, California, U.S., April 30, 2015. REUTERS/Patrick T. Fallon/File Photo

“A $20 million fine is very small, (...) allows him to stay there and also introduces some healthy governance measures.”

NEW MANAGERS

Musk has gained legions of fans for his bold approach to business and technology, using his 23 million Twitter followers account to promote Tesla, his rocket company SpaceX, and tunnel venture, the Boring Co.

But the claim on Aug. 7 that he had the funding to take Tesla private, and a subsequent U-turn, stunned Wall Street and came amid public appearances which saw Musk smoke marijuana live on a radio show and call a British diver in the Thai cave rescue a “pedo”.

As part of the settlement with the SEC, Tesla will also appoint an independent chairman and two independent directors, responding to calls on Wall Street to relieve the pressure on Musk and provide more balance in the carmaker’s management.

“This is one of the best cases for appointing an independent chair we have seen in a while,” said Courteney Keatinge, research director for proxy adviser Glass, Lewis & Co.

“His behavior hasn’t been great for a while. And I think this kind of behavior has a ripple effect, when there isn’t steady leadership at the top.”

Lawyers said the settlement and size of the fine might give more ammunition to short-sellers pursuing separate cases against Musk for manipulating company shares through the Aug. 7 tweet, as well as to a probe by the Justice Department.

But several experienced litigators also said that, while the DOJ probe is separate, the SEC’s settlement might mark the end of official action against Tesla and Musk.

“The standard of proof for any potential criminal charge is higher than that of a civil case, which the SEC had,” said Jay Dubow, a former branch chief in the SEC’s enforcement division.

“It is possible that the DOJ investigation does not result in any criminal charges at least in part because the DOJ could determine that the SEC’s action resolved the matter and that no further governmental action is required.”

Neither Musk nor Tesla admitted or denied the SEC’s findings under the settlement, which still must be approved by a court.