It was a close shave for a South Carolina woman who was attacked by an 8-foot-long alligator Thursday. A neighbor became her savior as he fought off the gator with a shovel.

The woman was walking her dog around a lagoon in the Hilton Head Plantation neighborhood when the incident took place, WSAV reported. Neighbors who saw the attack alerted Hilton Head Island Fire Rescue emergency responders. 

The alligator had pierced its jaws into the woman's legs and tried to pull her down into the water. A local resident heard the commotion and attempted to help pull the woman out of the water. The witness' husband picked up a shovel, ran into the water and repeatedly hit the alligator until it let go of her.

The woman was rushed to a hospital in Savannah, Georgia, with serious leg injuries. Her exact condition remains unknown. The dog was unharmed, the Beaufort County Sheriff's Office (BCSO) said, CBS-affiliated television channel WTOC reported.

"This is an unfortunate incident," a Hilton Head Island Fire Rescue official said. "We advise residents to be aware of their surroundings, especially if they are taking walks with small pets near lagoons that are habitats for alligators."

Hilton Head Plantation officials said the alligator will be euthanized. A necropsy will be performed to see if people had fed the alligator. Feeding can cause alligators to start associating people with food, an official said.

"We are very grateful for the quick thinking and brave neighbors who fought off the alligator and held onto the victim who was being pulled into the water by the alligator," the official said Thursday, Fits News reported. "We are also most grateful for the work of our Security Officers and HHI Fire and Rescue, who treated the victim at the scene and transported the victim to the hospital, SCDNR, for their quick response to remove the alligator and the Beaufort County Sherriff's Deputies for their quick response and assistance."

This is reportedly the second alligator attack on a Hilton Head resident in nearly three years.

alligator A captive alligator is pictured as it rains in Oviedo, Florida, June 18, 2016. Photo: REUTERS/Carlo Allegri