A 2-year-old boy was found safe in central Minnesota last week after his family dog played a key role in assisting authorities with the search.

The toddler went missing on Thursday evening after wandering off from the farmyard he and his siblings were playing in near Richmond. According to the Stearns County sheriff’s office, the boy’s grandmother came outside to check on the children and could not find the boy.

The family searched the farmyard for about 30 minutes before contacting the sheriff’s office around 6:17 p.m.

An initial search by a sheriff’s deputy yielded no results. Multiple police dogs were brought in, including two bloodhounds certified in searching for lost people. Those searches also came up with nothing.

The sheriff’s office then began an aerial search.

A Minnesota State Patrol helicopter arrived on scene shortly after 8 p.m. The pilot found the boy and his dog about 9:30 p.m. using the helicopter’s heat-sensing camera. The pilot then directed ground searchers to the boy’s location, where they found him and his dog safe.

The boy was reunited with his mother and underwent a precautionary medical evaluation. The boy was in good condition but was cold and hungry.

Following the rescue, officials learned the family dog found the boy and stayed with him until help arrived.