A five-month-old baby has miraculously survived more than nine hours being buried under a pile of sticks and debris in the woods of western Montana, suffering only minor injuries despite wearing wet and soiled clothes in cold weather, authorities said Monday.

The baby boy is otherwise in good condition, authorities said.

Missoula county sheriff’s deputies were called about 8pm Saturday about a man threatening people in the Lolo Hot Springs area of the Lolo national forest.

Deputies apprehended the man, who indicated that a baby was buried somewhere in the woods.

The sheriff’s office hastily put together a search crew of federal, state and local officials that combed the forest outside the hot springs for six hours before a deputy heard a baby’s cry at about 2.30am Sunday.

He found the baby facedown under the pile of sticks and debris, dressed only in a wet and soiled onesie in the 46F (8C) weather.

“He suffered some minor scrapes and bruising but overall is in good health,” sheriff’s spokeswoman Brenda Bassett said in a statement Monday.

The baby was taken to a hospital. Custody of the child has been referred to the state division of child and family services. Spokesman Chuck Council declined to answer any questions about where the child will be placed or how the baby will be cared for, citing medical privacy.

Francis Crowley, 32, was being held on $50,000 bail on a charge of criminal endangerment. Additional charges will follow, the sheriff’s office said in a statement Sunday.

“For all of us at the sheriff’s office, this is what we call a miracle,” the statement 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 nature of Crowley’s relationship to the baby was not immediately clear. There was no information on whether Crowley had an attorney.