Elon Musk’s tweet in which he called a British man a "pedo guy" should not have been taken literally and was just a retaliatory insult, the billionaire has told a court.

The Tesla chief executive is being sued by Vernon Unsworth who was involved in the rescue of the Thai boys football team from a flooded cave in July 2018.

The case stems from an offer to supply a mini-submarine by the entrepreneur that would help transport the boys trapped in the cave.

Three days after the rescue was successfully completed, Mr Unsworth told CNN that Musk’s offer was a PR stunt and that he should stick his submarine where it hurts.

Testifying at his defamation trial, Musk said he was merely responding in kind to Mr Unsworth’s remarks which he described as an unprovoked attack on what was a good-natured attempt to help the kids.

It was wrong and insulting, and so I insulted him back.

I thought he was just some random creepy guy.

Under questioning, Musk insisted he did not mean for his tweet to be taken literally.

I assume he did not mean to sodomise me with a submarine… just as I didn’t literally mean he was a paedophile.

Musk repeated the defence he first used in court papers lodged in September, insisting the phrase pedo guy was commonly used in his native South Africa and meant creepy old guy, rather than being an allegation of paedophilia.

Earlier, in an opening statement, Mr Unsworth’s lawyer said taking the billionaire to court was the only thing he could do in response to the allegation.

He said Musk should not have branded his client a paedophile in what should have been one of the proudest moments of his life.

Lawyers for the diver have alleged that Musk hired private investigators to find evidence that he was a child abuser – to no avail.

Musk had previously claimed he was not being factual, saying no one reading his tweet would take it seriously, but later sent emails to BuzzFeed News, claiming Mr Unsworth was a child rapist and had only moved to Thailand to take a child bride who was about 12 years old at the time – but provided no evidence.

(c) Sky News 2019: Elon Musk says ‘pedo guy’ tweet should not be taken ‘literally’