A man who had gotten away with murder confessed to police after seeing “The Passion of the Christ” and talking with a spiritual adviser, authorities say.

Dan R. Leach’s viewing of Mel Gibson’s cinematic depiction of the last hours of Jesus, along with the discussion with a family friend, led him to walk into the Fort Bend County sheriff’s department earlier this month and confess to killing Ashley Nicole Wilson, Detective Mike Kubricht said Thursday.

A coroner had ruled her death by hanging a suicide.

Wilson’s body was discovered Jan. 19 in her apartment near Richmond, southwest of Houston. All physical evidence pointed to suicide, Kubricht said, and the 19-year-old had gone off anti-depressant medications because she was pregnant.

The pregnancy apparently was the motive, Kubricht said, because Leach believed he was responsible and did not want to raise a child.

Leach, 21, wore gloves and left none of his own DNA behind, Kubricht said.

“He was very, very meticulous,” Kubricht said. “It was very well-planned and well executed.”

He was arrested Tuesday, a day after his indictment for murder, and remained in county jail on $100,000 bond. He was expected to get a court-appointed attorney, Kubricht said.

“Something (the adviser) said, between that and the movie, he felt in order for him to have redemption he would have to confess his sin and do his time,” Kubricht said.

Leach faces up to life in prison if convicted.