LONDON — Elon Musk made a qualified apology Wednesday for calling one of the rescuers of a youth soccer team from a Thai cave a “pedo” — but the Tesla CEO still managed to take a swipe at the media.

The billionaire said his slur — posted on Twitter where he has 22 million followers — was made “in anger” following criticism of his mini-submarine rescue idea.

Musk and his team of engineers at SpaceX and The Boring Co. designed the craft to help rescue 12 boys and their 25-year-old coach who became trapped June 23 when a flash flood blocked their cave entrance. They were finally brought to safety last week. A Thai Navy SEAL died during the operation.

Elon Musk. Mark Brake / Getty Images file

Vern Unsworth, a British cave explorer involved in the operation, dismissed Musk’s device as "a PR stunt” that had “absolutely no chance of working.” The 63-year-old said in a weekend interview that Musk could "stick his submarine where it hurts."

Musk responded in a series of now-deleted tweets: "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.

"Water level was actually very low … you could literally have swum to Cave 5 with no gear, which is obv how the kids got in. If not true, then I challenge this dude to show final rescue video."

He then added: "You know what, don't bother showing the video. 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."

Many users urged Musk to withdraw the comment, but he doubled down, writing "bet ya a signed dollar it's true" before deleting.

Unsworth told reporters that he was considering legal action.

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

“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’s apology was not posted publicly on his feed but came in a reply to another user who declared “journalism is dead” and linked to an opinion article on crowd-source site, Quora, taking aim at the “criticism machine” and “shoddy journalism" surrounding Musk's remarks. The opinion article, written by “startup guy” Jeremy Arnold, claims that “most news outlets have, for whatever reasons, failed to tell” the more “nuanced” story.

“I think what Musk wants most is fairness. That doesn’t strike me as unreasonable,” Arnold wrote.

Musk said the article was “well-written.”

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. The fault is mine and mine alone. — Elon Musk (@elonmusk) July 18, 2018

In May, Musk faced criticism for dismissing questions from analysts and reporters on a conference call as "bonehead" and "boring"and even proposed a Yelp-style ratings system for journalists.