A year ago, a 2-year-old dog with broken legs, ribs and a belly full of carpet was fortunate enough to be saved by an animal shelter and adopted into a loving home.

Now, a year later, the dog’s the one doing the rescuing.

The medium-sized mixed-breed named Peanut suddenly started barking uncontrollably while inside her home in Escanaba, Michigan, Friday morning. The behavior was certainly unusual for the ordinarily shy pup.

Get Breaking News Delivered to Your Inbox

She ran up and down the stairs, barking and yelping until her owner finally let her outside. Once the door opened, the dog barreled into an open field behind the house -- her confused owner following close behind.

Eventually, the dog stopped in front of a ditch, and looked back at her owner.

At first, the man pulled on the dog’s collar to turn back, but then he took a closer look and saw a naked little girl curled up into a ball, shivering uncontrollably in the freezing temperatures. Quickly, he hopped into the ditch and wrapped her in his shirt, running back home with Peanut on his heels.

The family called 911 as they covered the girl in blankets to warm her up.

“By the time the ambulance and police arrived, the little girl could only say one thing -- ‘doggie,’” the dog’s owner explained in a letter to the Delta Animal Shelter, where they adopted the dog last April. “Thanks to Peanut, a little girl’s life was saved.”

Former Abused Shelter Dog now Local Hero Petunia arrived at the shelter last April with 2 broken legs, a belly full of... Posted by Delta Animal Shelter on Monday, March 20, 2017

Michigan’s Delta County Sherrif’s Office confirmed the family’s story in a news statement on Monday, crediting the canine for alerting his owner to the child’s presence.

The little girl was not injured and was transported to a nearby hospital for tests, while deputies went door to door in an attempt to find her parents, authorities said. The parents were eventually located at a house nearby.

“Further investigation unveiled unsafe and unsanitary living conditions at the residence,” the sheriff’s office reported. “Child Protective Services was contacted and the found girl along with another young female were eventually removed from the residence.”

Police said the case has been sent to the Delta County Prosecutor’s Office for review.

“Through all of this sad news, give thanks the children are safe,” the Delta Animal Shelter wrote in a post on Tuesday. “The good in this heartbreaking story is the heroism of this former abused shelter dog Peanut, and her wonderful adoptive family.”

The family agreed, praising Peanut for her “sixth sense.”

“Without her, not only would she have been gone from this world, but the life of this little girl might have been taken as well,” Peanut’s owner said.