A former Ohio music pastor who once appeared on “American Idol” was convicted of murder Tuesday in the killing of his wife while he was having an affair.

Prosecutors said Caleb Flynn, 40, staged a home invasion in February after shooting his wife, Ashley Flynn, a 37-year-old schoolteacher and volleyball coach.

Flynn, who claimed his wife was killed by a burglar, could get up to life in prison without the chance of parole when he’s sentenced on Monday.

He closed his eyes, shook his head to the side and fought to maintain his composure as the judge read the guilty verdicts on charges of murder, felonious assault and tampering with evidence. Flynn began sobbing while the judge dismissed the jury.

Flynn appeared on “American Idol” in 2013, telling TV viewers about how his wife had encouraged him to chase his dreams on the singing competition. He sang before judges Mariah Carey, Randy Jackson and Nicki Minaj but did not advance to the main competition in Hollywood.

Prosecutors told jurors during closing arguments Tuesday that Flynn wanted out of his marriage when he shot his wife at their home in Tipp City, a suburb north of Dayton. Flynn and the couple’s two daughters were home when police arrived.

Flynn also didn’t want to lose his daughters, his high-paying job at his wife’s family business or his position in the church, prosecutors said.

“He wanted to keep his mistress and have his daughters all to himself,” said Matthew Joseph, an assistant Miami County prosecutor.

During the trial, a woman who said she was having an affair with Flynn testified that he said he hated his wife and had thoughts of killing her.