Elon Musk has agreed to buy Twitter for the initially agreed upon price of $44bn, or $54.20 per share, likely putting an end to the high-profile legal battle.

Musk sent a letter to Twitter yesterday (4 October) which included an offer to go ahead with the deal, two weeks before they were due to go to trial.

Twitter was widely seen as having the stronger case, meaning that it would win its case to force Musk to commit to the takeover or pay a $1bn breakup fee.

A letter sent to Twitter from the Tesla boss said that the deal would now be going ahead once debt financing was received, provided the court halted the legal action and adjourned the upcoming trial and related proceedings.

"The Musk parties provide this notice without admission of liability and without waiver of or prejudice to any of their rights," the letter said.

In a statement, a Twitter spokesperson said it had received the letter and that the "intention of the company is to close the transaction at $54.20 per share".

Musk tweeted earlier today: "Buying Twitter is an accelerant to creating X, the everything app."

The parties met in court in an emergency hearing via Zoom earlier today with the judge, Kathaleen McCormick, according to the Financial Times.

Following the announcement of the deal, Twitter's share price rose from $42.95 to $52.

Neil Campling, head of TMT research at Mirabaud Equity Research, said: "Elon Musk is to proceed with his Twitter deal. The simple conclusion may be that this reflects the weakness of Musk's legal arguments in the case.

"That is the "simple conclusion", but when has Elon Musk ever done "simple"? The answer is never. What other factors could be at play? Well, this happens to come just after Tesla reported woeful delivery numbers for Q3, which was announced on Sunday, just as the markets were "sleeping". The Twitter news does feel like a classic Musk distraction tactic."