Elon Musk revived a bid to buy Twitter Inc. at the original price of $54.20 a share, backtracking on his effort to quit the deal and potentially avoiding a contentious courtroom fight.

Musk made the proposal in a letter to Twitter on Monday, according to a filing with the Securities and Exchange Commission that confirmed a Bloomberg report.

Shares of Twitter climbed 22% to $52 at the close in New York.

San Francisco-based Twitter said it received the letter and intends to close the deal at the agreed-upon price, without commenting specifically on how it will respond to Musk.

For Twitter, proceeding with Musk’s plan augurs a future under a mercurial billionaire who has spent months publicly criticising its management, questioning its value and changing his mind.

It also means that his contested claims that Twitter was lying about which percentage of users were bots, for instance are not likely to be scrutinised in a court of law.

Musk had been trying for months to end his contract to acquire Twitter, signed in April.

The billionaire began showing signs of buyer’s remorse shortly after the deal was announced, alleging that Twitter had misled him about the size of its user base and the prevalence of automated accounts known as bots.

Musk formally quit the accord in July and Twitter sued him in Delaware Chancery Court to force him to go forward with the purchase. A trial had been scheduled to begin Oct. 17.

The judge in Delaware on Tuesday asked both sides to come back to her with a proposal on how the case can now proceed.

The options include having Twitter seek to dismiss the case or have her continue to retain jurisdiction until the deal closes, said a person familiar with the matter.

In the letter, Musk’s attorneys wrote that he and his supporters “intend to proceed to closing of the transaction contemplated by the April 25, 2022, merger agreement, on the terms and subject to the conditions set forth therein.”

The plan is also contingent on him lining up the necessary debt financing and the court issuing “an immediate stay of the action.”

It’s a tough time for banks to sell debt. With yields at multiyear highs, banks led by Morgan Stanley could be on the hook for hundreds of millions of dollars of losses on the unsecured portion alone, should they attempt to unload it to investors.

Musk later tweeted that “buying Twitter is an accelerant to creating X, the everything app.” Musk has said he wants Twitter to be more like TikTok and WeChat, with many more highly engaged users.

In the run-up to the planned Delaware proceedings, lawyers for both sides have fired cannonades of subpoenas at each other aimed at teasing out testimony and evidence. Musk’s side needed to demonstrate that Twitter violated the terms of the deal.

Twitter alleged that Musk used the bots issue as a pretext for backing out a deal he no longer found economically sound.

Musk’s legal team was getting the sense that the case was not going well, as Judge Kathaleen St. J. McCormick sided repeatedly with Twitter in pretrial rulings, according to one person familiar.

Even with the late emergence of a Twitter whistleblower who alleged executives weren’t forthcoming on security and bot issues, there were concerns Musk’s side would not be able to prove a material adverse effect, the legal standard required to exit the contract.

Inside Twitter on Tuesday, many employees were sitting through 2023 planning presentations when the news first started to circulate, according to multiple sources.

Presenters did not acknowledge the news, which staffers saw spreading on their own social network.

Many employees have opposed the idea of working for Musk, who has been openly mocked and criticised on internal Slack channels since the deal was signed.

In an internal memo Tuesday to Twitter staff, viewed by Bloomberg News, General Counsel Sean Edgett thanked workers for their patience as the company works through the legal issues.

“I will continue to keep you posted on significant updates,” he wrote. Trading of Twitter shares was halted after the news broke and didn’t resume until after the company confirmed receipt of Musk’s letter.

Twitter shareholders voted Sept. 13 to accept the buyout offer as Musk submitted it.

The company said at the time that 98.6% of the votes cast were in favor of the deal. Musk, Twitter’s largest shareholder, didn’t vote at all, according to two people familiar with his decision.

Musk owned almost 10% of Twitter — more than 73 million shares — when he agreed to acquire the company.

Musk was scheduled to answer questions about the deal in Austin, Texas, on Oct. 6-7, according to a court filing Tuesday. Twitter Chief Executive Officer Parag Agrawal was scheduled to sit down for his deposition Monday.