A 5-month-old baby who was buried in a Montana forest for at least seven hours was found in the middle of the night Sunday, officials in Missoula said Monday.

The infant was in good condition at a hospital after being left alone for "several hours," the Missoula County Sheriff’s Office said in a statement.

A man who was supposed to be taking care of the infant, Francis Carlton Crowley, 32, was arrested for criminal endangerment, authorities said. Additional charges were expected. It wasn't clear what Crowley's relationship is to the child or who the boy's mother is.

"For all of us at the sheriff’s office, this is what we call a miracle," the sheriff's office said. "For the officers who were present for this event, it’s especially hard knowing what this small baby endured in the last 24 hours."

The sheriff's office said authorities were called to the Lolo Hot Springs area of Montana's Lolo National Forest at about 8 p.m. Saturday night (11 p.m. ET) on a report of a man threatening people and acting strange.

"When trying to question Crowley, he appeared to be under the influence of drugs and was not making sense to officers," the sheriff's office said — adding that Crowley "indicated the baby was possibly buried somewhere in the mountains."

Francis Carlton Crowley Missoula County Sheriff's Office

Deputies and officers from United States Forest Service, Bureau of Land Management, Montana Highway Patrol quickly formed a search party and were dispatched to try and find the child.

"After more than six hours of searching on foot, a deputy heard the faint cry of a baby," authorities said. "He followed the sound and found the baby alive, face down, buried under a pile of sticks and debris."

It was was 2:30 a.m. Sunday local time and 46 degrees outside when they found the infant, the sheriff's office statement said. The boy was wearing only a wet, soiled onesie.

A clerk at Missoula's Justice Court said it wasn’t clear if Crowley had a lawyer.