ELLSWORTH, Maine — An 8-month-old puppy stranded for up to four days on a ledge in Acadia National Park is back with her family thanks to several park rangers determined to find an elusive dog heard crying in the woods.

Bailey, a young and energetic black Lab, apparently wandered away from her home in Southwest Harbor on Sunday. Her owners, Taylor Reed and Jordan Pelletier, searched for Bailey into Monday and put up “missing dog” posters but to no avail.

Then park rangers received a call on Monday from hikers who heard a dog crying in the area of Acadia’s Great Notch and Razorback trails. Park rangers also heard the dog’s whines but could not pinpoint the source because of the dense woods and craggy nature of the forest, supervising Ranger Ed Pontbriand said Friday.

Rangers returned on Tuesday and Wednesday — with several working on their days off — to search for Bailey but again came up empty-handed. Then on Thursday Ranger Jed Fiske — by spending his second straight day off looking for Bailey — found the dog hidden on a ledge off the Razorback Trail.

“It was on a shelf and it couldn’t go up or down,” Pontbriand said.

Using ropes, Pontbriand rappelled down to the dog and helped hoist her up to several waiting rangers. After receiving some water, Bailey immediately perked up and appeared “as happy as a dog could be” as she wagged her tail amongst the rangers, he said.

“You would never have known it had been there for four days,” Pontbriand said.

On Friday, Reed said she had nearly given up hope of finding the dog before she received a call from the park service on Thursday.

“I honestly couldn’t believe it,” Reed said. “I had been crying myself to sleep every night thinking that I wouldn’t see her again.”

The veterinarian who checked out Bailey said she just needed some extra food and rest but otherwise was healthy.

“She is doing awesome,” Reed said. “She is so happy to be home.”