Elon Musk and U.S. securities regulators have settled their dispute over the Tesla CEO’s tweets, with Musk agreeing to having his future communications regarding the electric-car maker pre-approved by a company-employed expert.

The Securities and Exchange Commission (SEC) and Musk reached the agreement, which they detailed in filings Friday in federal court in Manhattan. The agreement must be approved by U.S. District Judge Alison Nathan, who has presided over the case.

The deal means Musk would no longer face the threat of being held in contempt as the SEC has demanded. The agency had alleged that Musk violated a previous settlement requiring his tweets to be approved by a lawyer if they disclose important company facts.

The SEC said Musk violated the deal with a Feb. 19 tweet about Tesla vehicle production that wasn’t approved by the company’s “disclosure counsel.” The agency contended that Musk hadn’t sought the lawyer’s approval for a single tweet.

Musk’s attorneys contended his tweet that Tesla would produce about 500,000 vehicles this year didn’t need approval because it wasn’t new information that would be meaningful to investors. They said the SEC was violating Musk’s First Amendment rights to free speech.