Twitter has confirmed that Elon Musk has offered to buy the company for the second time this year.

In a statement, the social media site has said it plans to agree to the offer at  54.20 dollars (£47.23) per share, the same price Mr Musk previously put forward.

The total value of the deal would be 44 billion dollars (£38.3 billion).

A spokesperson for Twitter said: “We received the letter from the Musk parties which they have filed with the SEC. The intention of the company is to close the transaction at 54.20 dollars per share.”

Elon Musk to buy Twitter

Twitter’s stock surged 22.2% to 52 dollars (£45.31) after the announcement.

The Tesla and SpaceX founder offered to purchase the company earlier this year, however he pulled out in July.

Lawyers for Musk said it was due to the platform “not complying with its contractual obligations” surrounding the deal, namely giving him enough information to “make an independent assessment of the prevalence of fake or spam accounts on Twitter’s platform”.

Twitter said in response it was “committed to closing the transaction” and launched legal action. Musk later countersued.

A month later, in a published court document, Twitter accused Musk of “looking for an excuse” to get out of the deal, with the firm calling Musk’s accusations “factually inaccurate, legally insufficient, and commercially irrelevant”.

In late August, a former company executive at Twitter turned whistleblower, Peiter “Mudge” Zatko, accused the website of having substantial security problems that place personal user data and potentially national security at risk.

In response, Twitter disputed Zatko’s account, adding that there was a “false narrative about Twitter and our privacy and data security practices that is riddled with inconsistencies and inaccuracies”.

The company added that he had been sacked in January for “ineffective leadership and poor performance.”