Elon Musk has never been someone to back down from a fight. On Tuesday, Musk's confrontational personality brought him to a Los Angeles federal courtroom to testify in a defamation lawsuit brought by British cave explorer Vernon Unsworth. Musk told the court that he didn't intend for people to take it literally when he labeled Unsworth a "pedo guy" on Twitter, a site where he had more than 20 million followers.

Musk's feud with Unsworth began in July 2018, when Unsworth and Musk were both trying to help a dozen boys trapped in a flooded cave in Thailand. Unsworth, who had years of prior experience with the cave, advised authorities on the rescue effort. Meanwhile, Musk assembled a team of SpaceX engineers to construct a "miniature submarine" to aid in the rescue efforts.

The submarine was never used; rescuers had already rescued the boys by the time it arrived in Thailand. When Unsworth was asked about Musk's invention on CNN, he scoffed. The contraption had "absolutely no chance of working," Unsworth said, adding that Musk should "stick his submarine where it hurts."

Musk responded angrily on Twitter, vowing to demonstrate that the submarine could have squeezed through the tightest passages on the rescue route. "Sorry pedo guy, you really did ask for it," Musk added.

In his Tuesday court testimony, Musk said that he was merely trading one schoolyard taunt for another. Unsworth's comments were "an unprovoked attack on what was a good-natured attempt to help the kids," Musk told the court. "It was wrong and insulting, and so I insulted him back."

"I thought he was just some random creepy guy," Musk said, according to Reuters. "I thought at the time that he was unrelated to the rescue."

"I knew he didn't literally mean to sodomize me with a submarine, just as I didn't literally mean he was a pedophile," Musk said.

“I fucking hope he sues me”

But Unsworth's lawyers have pointed to a string of subsequent statements that suggest Musk did mean it literally.

"Bet ya a signed dollar it's true," Musk tweeted when someone objected to his use of the phrase "pedo guy." In a tweet a month later, he asked: "You don't think it's strange he hasn't sued me?"

Then in an email to BuzzFeed reporter Ryan Mac, Musk claimed that Unsworth traveled "to Chiang Rai for a child bride who was about 12 years old at the time" and described Unsworth as a "child rapist." (Unsworth has denied these claims.)

"I fucking hope he sues me," Musk wrote. Musk labeled his email "off the record." But Mac, who hadn't agreed to keep the exchange confidential, published it anyway.

In October this year, Mac revealed Musk's source for these explosive charges: a $50,000 private investigator Musk hired to dig up dirt on Unsworth. Musk argues that his later statements were based on the investigator's preliminary findings. But the investigator turned out to have a felony fraud conviction, and he never turned up evidence supporting the claims. Unsworth's wife says she was actually 33, not 12, when she met Unsworth.

“Joking, taunting tweets”

In his opening statement, Musk's lawyer argued that his tweets were not allegations of criminal behavior by Unsworth. "They're joking, taunting tweets in a fight between men," he said.

He also accused Unsworth of wanting to "milk his 15 minutes of fame," according to the New York Post.

But an attorney for Unsworth portrayed Musk as vain and vindictive. He said Unsworth sued Musk for "accusing him of being a pedophile in what should have been the proudest moment of his life." Musk's tweets caused Unsworth "shame, mortification, worry, and distress," the lawyer told jurors.

Musk's high profile has made it difficult for the court to assemble an impartial jury. One potential juror was dismissed because he had an interview scheduled at SpaceX later in the month. Others were dismissed because they followed Musk on Twitter and had followed the case. Another prospect was let go after admitting she had strong opinions about billionaires.