A search-and-rescue team discovered a dog alive under a pile of debris in the Bahamas, more than three weeks after Hurricane Dorian struck the islands.

Big Dog Ranch Rescue, which is a South Florida-based rescue operation, used a drone with infrared heat-seeking technology to find the animal hidden under piles of air conditioning units in Marsh Harbour in the Bahamas.

The emaciated dog had been trapped under the rubble since early September, WOFL reported.

“[He was] nothing but a bag of bones but still wagging his tail,” said Big Dog Ranch Rescue’s founder and President Lauree Simmons.

Big Dog Ranch Rescue received word of the dog’s location on Friday. Within an hour, the rescue sent a plane to pick up the dog, named Miracle, and send him to the facility’s location in Palm Beach County, Florida, for life-saving medical treatment.

The people involved in Miracle’s rescue estimate that he had been trapped for more than three weeks.

“What an incredible story that we were able to discover this dog alive after being trapped for so long,” Simmons said in a statement. “We are using the latest technology for our recovery teams to locate these animals. In this case drones played a key role.”

The rescue said that Miracle is the 138th dog to be rescued from the Bahamas, which is still recovering from the effects of September’s Category 5 storm.