Tesla chief executive Elon Musk is set to go on trial for allegedly defaming British cave explorer Vernon Unsworth.

Mr Unsworth played a lead role in the rescue of 12 boys and their football coach from the Tham Luang Nang Non cave in Thailand in July 2018.

Mr Musk is known for his eccentric, sometimes controversial use of Twitter, but he may have to pay for using the platform to brand someone a paedophile.

Mr Unsworth says Mr Musk falsely labeled him a paedophile on the social media platform and should pay punitive and other damages for harming his reputation.

The trial before US District Judge Stephen Wilson in Los Angeles is scheduled to last about five days. Mr Musk is expected to testify in his own defence.

While the case does not involve Tesla, Mr Musk's Twitter habits have long been under a microscope, with investors and regulators expressing concerns about the accuracy of his tweets.

With 29.8 million followers, Mr Musk's Twitter account is a major source of publicity for his Palo Alto, California-based electric car company, which does not advertise.

The Unsworth case is among the last issues hanging over Mr Musk from a turbulent 2018 and early 2019, when he regularly clashed with Wall Street and short sellers as Tesla struggled with production problems.

The episode began after Mr Musk offered a mini-submarine from his SpaceX rocket company to help with the cave rescue.

Mr Unsworth told CNN on 13 July 2018, three days after the rescue was completed, that the offer was a "PR stunt" and that Mr Musk could "stick his submarine where it hurts".

Two days later, Mr Musk lashed out at Mr Unsworth in a series of tweets, including one where he used a term referring to him as a paedophile.

Mr Musk later apologised for that comment. Mr Unsworth has denied Mr Musk's accusations.

To win the defamation case, Mr Unsworth needs to show that Mr Musk was negligent, which does not require an intent to defame.

He must prove the tweets were false, that Mr Musk did not use reasonable care to determine if they were true, and that people reasonably understood them to mean he was a paedophile.

The case against Mr Musk got a boost when Judge Wilson last month said Mr Unsworth's sudden fame from the rescue did not make him a "public figure", meaning he did not need to show that Mr Musk acted with "actual malice" when posting his tweets.

Lawyers for Mr Musk have said the tweets were opinion, not statements of fact.

They have also said Mr Unsworth sought to profit from his role in the rescue and provoked Mr Musk's response by suggesting on CNN that Mr Musk did not care about the lives of the trapped boys.