A convicted sex offender charged with kidnapping and murder spent days stalking the home where three people were bludgeoned to death and two young children were abducted, according to court documents.

Joseph Edward Duncan III (search) had spotted 8-year-old Shasta Groene (search) playing in a bathing suit with her 9-year-old brother, Dylan, the documents say.

"[Duncan] told her he watched her two or three days, and at night would peer inside the home," Detective Brad Maskell told the judge, according to records from a closed-door probable cause hearing Tuesday. The records say he used night-vision goggles to learn the home's layout before bursting in.

Duncan, 42, was charged with first-degree murder and first-degree kidnapping in the bludgeoning deaths of the children's mother, Brenda Groene (search), her 13-year-old son Slade and her boyfriend Mark McKenzie.

If convicted, he could face the death penalty.

Shasta's ordeal began when she heard her mother call her into the living room early on the morning of May 16, according to authorities. There, she told investigators, she saw Duncan wearing dark gloves and holding a shotgun.

Her mother, brother Slade and McKenzie were bound with zip-ties and duct tape.

Duncan then bound her and Dylan and left them on the ground outside near a swing set. Shasta said she heard McKenzie yell out several times, and at one point they saw Slade stagger, bloody and incoherent, out of the home.

Maskell said Duncan bragged to the girl about killing her family with a hammer and showed it to her.

Duncan was a known sex offender wanted in Minnesota for jumping bail on a molestation charge, but he didn't become a suspect in the Idaho slayings until six weeks later when he walked into a Denny's restaurant with Shasta a few miles from her home. A waitress recognized the little girl and called police.

Shasta has since been reunited with her father. Investigators who interviewed her located Dylan's body in a remote Montana campsite where authorities believe Duncan took the two children.

Duncan had been charged with kidnapping Shasta and Dylan, but those state charges will be dismissed and instead handled by the federal court system because the youngsters were taken across a state line, Douglas said.

Officials have alleged that the children were repeatedly sexually molested during their ordeal, and sheriff Rocky Watson has said he believes the motive for the killings was to acquire the children for sex.

Watson also has said that authorities believe the family was chosen at random, but that the attack was carefully planned and executed.

Duncan was released on $15,000 bail earlier this year in Becker County, Minn., after being charged with molesting a 6-year-old boy. Police in Fargo, N.D., where Duncan lived, had been looking for him since he failed to check in with a probation agent there in May.

Duncan had spent more than a decade in prison for sexually assaulting a 14-year-old boy at gunpoint in Tacoma, Wash.