Elon Musk has apologized for calling British diver Vern Unsworth a “pedo guy” following the week-long operation to rescue 12 boys and their soccer coach from a flooded cave in northern Thailand that had the world on the edge of its metaphorical seat.

The tech billionaire had called Unsworth a “pedo guy” on Sunday in a series of tweets that have since been taken down. Musk, who earlier made a trip to Thailand to offer assistance by way of a submarine, was reportedly offended when Unsworth dismissed the usability of Musk's device — and his intentions.

Rescue teams on the ground had earlier rejected his submarine, saying it was “a surplus to requirements,” The Guardian reported.

“My words were spoken in anger after Mr. Unsworth said several untruths & suggested I engage in a sexual act with the mini-sub, which had been built as an act of kindness & according to specifications from the dive team leader,” Musk wrote in a Twitter thread on Wednesday.

Musk was likely referring to Unsworth’s comments to CNN on Sunday, when he said, “[Musk] can stick his submarine where it hurts.”

“Nonetheless, his actions against me do not justify my actions against him, and for that I apologize to Mr. Unsworth and to the companies I represent as leader,” Musk tweeted. “The fault is mine and mine alone.”

The submarine had “absolutely no chance of working,” Unsworth said in the CNN interview,, adding that it was built in a “rigid” way that wouldn’t be able to accommodate the turns and corners of the cave.

“He had no conception of what the cave passage was like,” Unsworth said, adding it was “just a PR stunt.”

Musk was apparently responding to that when he wrote a series of tweets, attacking Unsworth, according to NBC.

“Never saw this British expat guy who lives in Thailand (sus) at any point when we were in the caves. Only people in sight were the Thai navy/army guys, who were great,” Musk wrote on Twitter, NBC reported.

“We will make one of the mini-sub/pod going all the way to Cave 5 no problemo. Sorry pedo guy, you really did ask for it,” he wrote in a follow-up tweet.

He refused to back down from his tirade for a while, despite reported censure from Twitter users.

He dug his heels in then, replying, “bet ya a signed dollar it’s true.”

Unsworth was “astonished and very angry,” The Guardian reported on Monday, adding that he was considering taking legal action against Musk.

He told Reuters on Wednesday that he was aware of the apology, and had no further comments.

The boys, a group of 12 soccer players and their 25-year-old coach, were stuck in a cave from June 23 until rescuers found them on July 2. They were rescued in groups over the next week, with the final operation ending on July 10. A former Thai Navy SEAL diver died during the rescue operations.

[Photo: Some of the 12 Thai boys attend a press conference on July 18 in Chiang Rai, northern Thailand. By Lillian Suwanrumpha/AFP/Getty Images]