An Arizona woman was stranded in a canal for 18 hours and had to hold onto a tree with her 55-pound dog for dear life after she had attempted to rescue the canine who had fallen in.

She clung to the tree and, just as she was prepared to give up, police arrived to help her and her pet to safety, FOX 10 Phoenix reported. 

"The will to survive is what makes this a great story," Wellton Police Sgt. Juan Salcido said, according to FOX 10. Salcido was the first on the scene to assist the woman, pulling her and her dog out of the canal.

ARIZONA MAN CHARGED IN SHOOING DEATH OF BALLET DANCER WIFE WHO ‘STARTLED’ HIM PLEADS NOT GUILTY TO MURDER

dog panting

The woman and the dog (not pictured) were pulled to safety after she clung to a tree and her dog for 18 hours before they were rescued.  (iStock)

Authorities were alerted of the situation by a train conductor who saw the woman and her dog. The conductor was in the eighth train that went by the day the woman was stranded with her pet.

ARIZONA DEATH ROW INMATE EXECUTED FOR 1984 MURDER OF 8-YEAR-OLD GIRL

Welton Arizona Police Department vehicle

"The will to survive is what makes this a great story," Wellton Police Sgt. Juan Salcido said, according to FOX 10. Salcido was the first on the scene to assist the woman, pulling her and her dog out of the canal. (Wellton Police Dept. )

WALMART SHOOTING ARIZONA: 1 WOMAN INJURED, 2 MEN IN CUSTODY, POLICE SAY

"Her body told the story of her constant fight. She had abrasions to her arms and legs," Salcido said. "She had a sunburn. She looked exhausted to the point she couldn't stand on her two feet. She made the statement to me and I know to deputies she was about to give up until she heard our sirens."

Authorities said the incident began when the woman was working in the area and allowed her dog to roam. The animal wound up getting too close to the canal and fell in.

Salcido said the situation exemplified the woman's ability to continue fighting for herself and her dog.

CLICK HERE TO GET THE FOX NEWS APP

The woman did not sustain any major injuries and is now recovering with her dog.