BOISE -- A Boise man who pulled his two little girls out of school and fled to a remote mountain in Nevada earlier this year has accepted a plea deal.

Joshua Dundon, 33, admitted to felony custodial interference - which falls under Idaho's kidnapping laws - and an infliction of great bodily harm sentencing enhancement Wednesday.

Dundon sparked an AMBER Alert and multi-state search in May after he disappeared with his daughters, aged 6 and 7.

Prosecutors say Dundon, who shared joint custody with the girls' mother, had been gripped by methamphetamine-fueled delusions when he went on the run. The defendant's family told police his increasingly strange behavior was concerning enough that they went over to his home to get the children the night before he fled with them.

MORE: Search underway for missing father and two children

Investigators later discovered that Dundon had torn holes in his walls, nailed all the doors and closets shut, and booby-trapped the house by leaking gas into it.

On the morning of May 10, Dundon picked the girls up from their elementary school, telling people they were headed on a camping trip. Instead, Dundon made his way south into Nevada, where he set his truck on fire in a remote part of Eureka County before walking into the woods with his children.

Prosecutor John Dinger said at a previous hearing that Dundon told his daughters they were in danger.

"The defendant told them that their mom was trying to kill them, that somebody burned down their house and poisoned their dog, and that police were coming to kill them," he said.

RELATED: Prosecutor: AMBER Alert dad told girls police were trying to kill them

But by May 15, Dundon clearly realized he needed help, authorities say. As evening fell, he left the girls alone on the mountain and walked barefoot and shirtless several miles to a nearby ranch house. The homeowners, who had already seen news of the AMBER Alert after Dundon's torched pickup was found, called 911.

Rescuers fanned out across the mountain, desperately looking for the missing children as darkness grew closer. Remembering her father's warning that the police were planning to shoot them, Dundon's 6-year-old was too afraid to call out when the girls heard deputies searching the woods around them, prosecutors say.

Fortunately, her older sister yelled for help, leading the searchers to their position. The rescuers stripped off their own coats to wrap around the girls, and carried them down the mountain.

PREVIOUS: Rancher, sheriff recount rescue of Boise AMBER Alert girls

Both children were suffering from hypothermia, and were taken to a Nevada hospital for treatment. They made a full recovery, and have since been reunited with their mother in Boise.

Dundon has been held in the Ada County Jail on a $5 million bond since he was extradited back to Idaho to face the charges. He is set for sentencing Nov. 7.