SAN FRANCISCO — Tesla CEO Elon Musk and the electric car company 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 and Exchange Commission announced the settlement Saturday, just two days after filing a case seeking to oust Musk as CEO.

The settlement will require Musk to relinquish his role as chairman for at least three years, but he will able to remain as CEO.