Tesla CEO Elon Musk apologized in a tweet Wednesday for apparently accusing a British diver who helped rescue 12 boys and their soccer coach from a Thailand cave last week of being a pedophile.

The war of words began after the tech billionaire proposed using a mini-sub to enter the cave and rescue the children, which cave diver Vern Unsworth essentially called useless.

“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.”

Musk claimed his words were “spoken in anger” after Unsworth allegedly told him to “engage in a sexual act with the mini-sub.”

Unsworth, who played a key role in the rescue, has not ruled out legal action against Musk for his twitter attack.

Unsworth said on Tuesday that he has been approached by British and American lawyers and will seek legal advice regarding the incident, Reuters reported.

Musk had visited the Thai cave where the soccer team was trapped and left a mini-submarine there in the event it could benefit rescuers. Musk called it a “kid-sized” sub, named Wild Boar — in reference to the soccer team — and posted pictures of the vessel being tested in a swimming pool in California.

Unsworth said the sub wouldn’t work and called Musk’s actions “just a PR stunt.”

“It just had absolutely no chance of working. He had no conception of what the cave passage was like. The submarine I believe was about 5 feet, 6 inches long, rigid, so it wouldn’t have gone round corners or round any obstacles,” Unsworth said. “It wouldn’t have made the first 50 meters into the cave from the dive start point. It was just a PR stunt.”

Musk shot back in a series of now-deleted tweets that complimented the Thai Navy SEALs, but crushed Unsworth, where he questioned water levels in the cave and whether or not “you could literally have swum there.”

“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.”

The tech billionaire’s apology comes after he reportedly doubled down on his claim, betting another Twitter user “a signed dollar it’s true.”

Fox News' Edmund DeMarche and Frank Miles contributed to this report.