Elon Musk will go on trial after calling a British diver who rescued boys trapped in a Thai cave a paedophile, a court has ruled.

A federal judge in Los Angeles rejected the billionaire's attempt to dismiss a defamation lawsuit filed by Vernon Unsworth and set a trial date of 22 October.

Mr Unsworth claims the Tesla chief executive defamed him with "unlawful, unsupportable and reprehensible accusations", according to court documents filed in California and seen by Sky News.

Mr Musk called Mr Unsworth a "pedo" in a post on his Twitter account last July after the diver dismissed his attempts to help rescue the young Thai football players as a "PR stunt".

Mr Unsworth was part of the team of international divers who successfully rescued all 12 youngsters and their football coach when they became trapped for two weeks by rising waters in a Thai cave complex.


Cave diver's anger at Elon Musk tweet

Mr Musk and engineers from his SpaceX rocket company had built a small submarine and shipped it to Thailand to help free the boys.

In seeking a dismissal of the lawsuit, Mr Musk's lawyers said his comments were "imaginative" or "over-the-top" insults that constituted protected opinion under the US first amendment.

But US district judge Stephen Wilson said Mr Musk was not communicating in "heated and volatile" settings and a reasonable jury could conclude that his comments were more than merely opinions.

Mr Unsworth is seeking more than $75,000 (£58,000) in damages, while the lawsuit also seeks a court order prohibiting Mr Musk from making any further disparaging comments.

Image: Musk appeared in court in New York last month for a separate legal case

Last month, Mr Musk agreed to have his social media posts regarding electric car maker Tesla pre-approved by an expert, in order to settle a separate dispute over his tweeting.

The South African-born businessman reached an agreement with regulator, the Securities and Exchange Commission, and must now get approval from a Tesla-employed lawyer before tweeting about a range of topics related to his firm.

It comes after Mr Musk tweeted he had secured funding to take Tesla private at $420 (£325) a share, sending stock on a wild ride.

He then later said he would not be taking the company private and regulators found he had lied about having the money to pull off the deal.