Image copyright AFP Image caption Mr Musk (R) called British diver Mr Unsworth (L) "pedo guy"

Elon Musk must defend himself in court after calling a diver who helped save Thai schoolboys trapped in a cave a paedophile, a Los Angeles judge says.

The federal court judge set a 22 October trial date.

Mr Musk is being sued by Vern Unsworth, who helped rescue the 12 boys from Thailand's Tham Luang caves last year.

The Tesla boss called Mr Unsworth a "pedo" in a Twitter post after the Briton said Mr Musk's attempt to help in the rescue was a "PR stunt".

Why has this come to court?

Mr Unsworth helped recruit experienced UK cave divers, who were instrumental in freeing the boys who had become stuck in the cave due to rising water levels in July 2018.

While efforts were ongoing, Mr Musk sent engineers from his Tesla company and a small submarine to Thailand to help free the boys. It was never used.

In an interview with CNN, Mr Unsworth called Mr Musk's efforts a "publicity stunt".

Responding in a series of tweets, Mr Musk elaborated on how the submarine might work and referred to Mr Unsworth as "pedo guy".

Mr Musk soon apologised and deleted the offending tweets, saying he had acted "in anger".

But he reignited the row in September.

In an email to a Buzzfeed reporter, he implored the journalist to "find out what's actually going on" and suggested the diver had taken no part in the cave rescue.

Mr Unsworth is seeking at least $75,000 (£57,700) in compensation plus punitive damages in his September 2018 lawsuit.

Image caption Vern Unsworth (R) helped bring top international cave rescuers to the mission, including Rob Harper (L)

The suit also seeks a court order preventing Mr Musk from making any further disparaging comments.

He said the Tesla chief executive defamed him with "unlawful, unsupportable and reprehensible accusations", according to court documents.

In seeking a dismissal, Mr Musk's lawyers argued the comments were "imaginative" or "over-the-top" insults in the heat of the moment that were protected under the US First Amendment.

But the judge said Mr Musk was not communicating in "heated and volatile" settings that might explain any excesses.