A former federal law enforcement officer, accused of having a sexual motive for smelling a girl's dirty underwear in her bedroom, will be allowed to serve unsupervised probation.

Deputy U.S. Marshal David Timothy Moon, 50, was touring a Phoenix home for sale last May.

While his real estate agent was in another room, Moon went inside a 3-year-old girl's bedroom, according to a police report. He focused on the laundry hamper in the corner. He dug through the dirty laundry and pulled out what appeared to be the girl's underwear.

Video shows, Moon appeared to hold the underwear close to his face and appeared to smell them. Minutes later, he returned to the bedroom for a second round with the preschooler's clothing. When he leaves the room for the second time, he appeared to notice the nanny cam. He quickly covered his mouth and said "goddamn it."

ABC15 reviewed the video with forensic psychologist John Delatorre, and he described what he saw as "a compulsion." Dr. Delatorre said he has evaluated hundreds of sex offenders and was not personally involved in Moon's case.

"This isn't someone who’s unsure and needs to look around and tries to figure out -- is this thing what arouses me?" Dr. Delatorre said. "He knows immediately.”

The girl's father, whose name ABC15 is not disclosing due to the nature of the crime, received motion alerts from the camera. When he saw the recorded video, he called Phoenix police. The father later told a judge he increased security at his home.

"What if he comes back?" the dad said. "What if he tries to hurt us or our daughter? What if he loses his job and has nothing else to lose?"

After hearing of the allegations, the U.S. Marshals Service fired Moon. He had been a federal agent for 24 years, and he worked in multiple states, including Arizona, Alabama, and Florida, according to an agency spokesman.

ABC15 learned Moon was not supervised by Arizona's U.S. Marshals. Instead, he reported to bosses in Washington, D.C.

We asked whether Moon faced similar allegations before. A Marshals spokesman told us they take all allegations seriously but can't comment on personnel matters.

Phoenix police uncovered other red flags.

According to the police report, a girlfriend said Moon heard police were looking for him, so "he threw out his computer" and his Gmail account had a video of "girls doing gymnastics" in an email from "him to himself."

Moon was indicted on two counts of felony trespassing with sexual motivation. He later made a plea deal for misdemeanor trespassing.

"This is by far the stupidest thing I've ever done in my life," Moon said in court during his sentencing last week.

"The actions by the defendant, in this case, show a need for evaluation, show a need for potential treatment, and that's going to go unnoticed, untreated if there's no evaluation done in this case," said Deputy County Attorney Marcus Beecher.

Judge Cooper denied the requests.

"It can seem unfair," Judge Cooper said, acknowledging the victim family's concerns. "It can seem like it's not enough."

Judge Cooper also acknowledged mitigating factors, such as Moon's lack of prior crimes, his military service, and work as a deputy marshal.

"The court believes that he is sincere in his remorse," she said.

Moon and his attorney declined interviews with ABC15.

"While the behavior that he demonstrates is sexually deviant, there's concern that there's not enough for maybe a jury to say he's a sex offender," Delatorre said.

Once he completes probation, Moon could apply for this trespassing case to be set aside. If approved, the complaint would be dismissed and judgment of guilt set aside.

Got a news tip? Email ABC15 Investigator Melissa Blasius at Melissa.Blasius@abc15.com and follow her on Twitter and Facebook.