Tesla chief executive Elon Musk may have just struck a deal to purchase Twitter but he has lost in his attempt to overthrow a 2018 settlement with the U.S. Securities and Exchange Commission that includes monitoring of his tweets.

Musk infamously reached a settlement with the SEC back in 2018 after his tweet about taking Tesla private. In addition to both Musk and Tesla being slapped with $20 million fines, the world’s richest man agreed to get clearance from Tesla lawyers for tweets and other public statements that could be material to the electric carmaker.

Lawyers for the entrepreneur have argued that the SEC’s pursuit of Musk had “crossed the line into harassment” and was impeding his constitutional right to free speech. On Wednesday, U.S. District Judge Lewis Liman slammed Musk’s attempt to overthrow the agreement.

Read More: SEC Argues “A Deal’s A Deal” As Elon Musk Attempts To Challenge Twitter Oversight

“Musk cannot now seek to retract the agreement he knowingly and willingly entered by simply bemoaning that he felt like he had to agree to it at the time but now — once the specter of the litigation is a distant memory and his company has become, in his estimation, all but invincible — wishes that he had not,” Judge Liman said.

Musk also failed in his bid to block a separate SEC investigation into tweets that he posted about selling some of his Tesla stock.

On November 6 last year, Musk asked his followers if they supported him selling 10 per cent of his Tesla stake. The majority of his followers voted ‘Yes’ and he has since sold more than $16 billion of Tesla stock. Reuters notes that the SEC has subpoenaed Musk and Tesla to determine if his tweets were vetted before they were published. Judge Liman added that it was “unsurprising” that the SEC has questions about how Musk went about determining whether he should sell stock or not.