A federal judge gave Tesla CEO Elon Musk and the Securities and Exchange Commission two weeks to work out their differences, punting a request from the agency to hold him in contempt of court for allegedly violating an October securities fraud settlement.
Musk told reporters he was "happy" and "impressed with the judge's analysis" as he left the hearing room in the U.S. District Court for the Southern District of New York on Thursday.
U.S Judge Alison Nathan said she had "serious concerns that no matter what I decide here, this issue won't be resolved." Nathan ordered both parties to "take a deep breath, put on your reasonableness pants" and work out a solution.
Musk was at the hearing on contempt charges requested by the SEC after he tweeted about the company's production forecasts on Feb 19. His settlement agreement prohibits him from using Twitter to make statements about Tesla's operations or financial position without company review and approval.
Nathan told Musk and the SEC that contempt charges are serious business. Everyone must follow the law, she said, whether you are a "small potato" or a "big fish."
Musk told reporters outside the courthouse that he would "most likely" be able to work out an agreement with the SEC over the next two weeks.
"I have great respect for the justice system and I think the judges in the American system are outstanding," Musk said before entering the courthouse in lower Manhattan.
When CNBC's Phil LeBeau asked Musk if he felt the same about the SEC, the CEO laughed and walked away.
SEC lawyers argued that Musk and his legal team offered a "series of shifting justifications" for his behavior on Twitter, citing 15 separate tweets they believe violated his settlement. They also accused Musk of "recklessly tweeting out material information that had no basis in fact" and caused confusion in the markets.
"We don't think every tweet needs to be approved," SEC attorney Cheryl Crumpton told the court, citing conversations on social media with Tesla customers as OK.
Statements much beyond that need to be cleared, she said.
Reaffirming guidance could be material and needs approval, she said, adding that Tesla still "appears to be unwilling" to exercise control over Musk.
Musk's lawyers said the judge's order was a gateway to a negotiation with the SEC.
"He actually does what he is told," Musk's lead attorney John Hueston told the court.
Musk sat in the center of the courtroom, flanked by three members of his legal team, periodically nodding in agreement with their arguments.
Securities lawyers and other industry executives have said that Musk, who has already been removed as chairman, could also lose his post as CEO if he keeps pushing the SEC.
"The court and SEC are in a bit of a bind here because capital punishment, if you will, would be ... throwing him out of company or banning him from running any public company from now on for violating this agreement with the SEC," Paul Ingrassia, Revs Institute for Automotive Research editor, said Thursday on CNBC's "The Exchange." "He is viewed as being the essence of Tesla. It's his brainchild. He's not only the public figure but also the creative genius behind it."
Tesla's shares plunged by more than 10% Thursday before recovering slightly to close down 8.2% after the company released its production and delivery data for the first quarter that missed Wall Street estimates and disappointed investors.
"At some point I think people have to start wondering would this company be better off with a calmer managerial presence in charge as opposed to a genius leader but a mercurial leader," Ingrassia said. "Is the company now at that stage of its development? But Musk has so much of the shares himself that that's probably not going to happen without an SEC or court order, which I doubt they'll be willing to do."
— CNBC's Michelle Fox contributed to this article.