A former lifeguard was attacked by an octopus while he was swimming at a beach in Western Australia.

Lance Karlson was with his 2-year-old daughter at Geographe Bay in Dunsborough when the octopus attacked.

Karlson shared a video of the incident on his Instagram account, captioning it: "The angriest octopus in Geographe Bay! After going after a seagull it then decided my daughter and I deserved a lashing! I later discovered its home amongst a crab graveyard, where it came after me again!"

Karlson said he and his daughter were walking on the shore when he saw the tentacles of an octopus moving fast toward a seagull in the water's surface. As Karlson walked up to the place where it happened, the octopus started moving toward him, whipping its tentacles at the pair before retreating.

When Karlson later went swimming, he found the octopus resting on a bed of shells. Suddenly, the sea creature rapidly swam toward him. He told 9News.com.au he was looking at the shells when the octopus attacked him. The creature struck him on the arm and the back of his neck.

"My goggles were too fogged to see what had happened and I swam back to shore in pain," Karlson said. "The imprints of the tentacles quickly formed raised marks across my skin."

Karlson quickly asked his wife to pour Coke over the wound, which was stinging as he left the water.

"There was some stinging, but after being a life saver for some years I've been stung by blue bottles and it was not anything like that," Karlson said. "It was more the pain from the physical strike of the octopus."

Octopuses, which are part of the cephalopod family, rarely attack humans. They are considered one of the most intelligent invertebrates, according to Britannica.

Recently, a tourist from Virginia posted a video on TikTok showing her unwittingly holding a blue-ringed octopus, which has venom enough to kill over 20 humans in a few minutes. Kaylin Phillips of Virginia was on a trip to Bali when she found the creature. The octopus is seen moving around her palm.

"I actually held two of them in the same day. I tried to feed them oranges and played with them for a solid 20 minutes," Phillips says in the video.

She wrote alongside the video on TikTok, "Going to Bali and unknowingly holding one of the most dangerous animals."

octopus
An octopus swims at the Ocearium in Le Croisic, western France, Dec. 6, 2016. LOIC VENANCE/AFP/Getty Images