Allan Countryman was attacked near Miall Island, part of the Keppel Island chain, that sit on the Queensland coastStuart Edwards / Wiki Commons

A man had to fight off a three-metre long shark by repeatedly punching it, after he was attacked in Queensland, Australia. The spear fisherman, named locally as Allan Countryman, suffered horrific injuries to his arms after he was mauled by a shark while in waters off in Yeppoon in central Queensland.

The 31-year-old was diving in shallow water off the tiny Miall Island when he was attacked just before midday on Saturday 2 January. He said he was in a shoal of mackerel when the shark appeared and attacked him forcing him to "repeatedly punch" out at the beast.

He was rescued by friends, the local coast guard and was given first aid by a bystander as they waited for paramedics from the Queensland Ambulance Service to arrive. He was then taken to Rockhampton Base Hospital by road and will receive treatment for his injuries in Brisbane – where he is said to be in a serious but stable condition with doctors working to save his arms.

The shark was said to be around 3 metres long Getty Images

Local coast guard commander Arthur Hunt said according to Sky News: "From what I understand he was snorkelling a bit off the beach and said he saw a lot of fish and then the shark came out of nowhere. It's the first shark attack we've had up here in a while – I've been (with the coast guard) for seven years and this is my first."

In total, there were 22 shark attacks recorded in Australia in 2015, according to data compiled by the Taronga Zoo in Sydney. Of those 22 just four were in Queensland while another 14 took place in New South Wales, further down the east coast.

Countryman's friend Donna Gudmann took to Facebook yesterday to thank those that helped Countryman after the attack. She said: "To the wonderful man who performed first aid on our friend before the coastguard got to him, please get in contact with me as his wife and all of us would like to thank you."