(CNN) -- A quick-thinking man grabbed a shark by the tail as it attacked an Australian woman, causing the shark to release its bite on her, rescue officials said.
The woman is recovering in intensive care, said the woman's employer, Rockingham Wild Encounters. The Western Australia company takes people on dolphin excursions.
The woman was snorkeling with passengers Saturday when a 2- to 3-meter (6.5- to 9.8-foot) shark attacked near Garden Island, according to Fremantle Volunteer Sea Rescue.
"A male passenger, who was nearby the girl when the shark attacked, managed to grab hold of the animal by the tail, causing it to let go. The girl started to sink, but was again helped by the man and taken back to the boat," Fremantle Volunteer Sea Rescue said on its website.
The woman had bites on both thighs and was in shock and in severe pain, the rescue agency said.
"The teeth marks were very deep and large," first-responder Frank Pisani said.
The victim was naturally concerned about the bites. But "I thought she was remarkably calm and in good spirits," even joking with friends as rescuers worked on her, he added.
She had even hit the shark on the snout during the attack, said Pisani, who skippered the rescue boat.
"She is still in intensive care, but all is going well," Rockingham said on its Facebook page. "There is minimal muscle or ligament damage, and she is expected to have full use of her legs. She is also pretty chuffed that the surgeons extracted a shark tooth from her butt!"
The woman underwent six hours of surgery, Rockingham said earlier, adding that "She is in good spirits and already looking forward to getting back into the water."
She benefited from a series of fortunate events, Pisani said.
"She was fortunate that she was close to shore. She was fortunate because of this hero. She was fortunate because of this medical boat," which was launched only weeks ago and quickly came to her aid Saturday.