OTTAWA — Joshua Boyle, a Canadian held hostage with his American wife in Afghanistan for five years, was cleared on Thursday of charges that he repeatedly abused and assaulted her after their rescue.

In the three hours it took Justice Peter K. Doody of the Ontario Court of Justice to dismiss 19 charges against Mr. Boyle, which included sexual assault, the judge repeatedly said that he did not believe the testimony of either Mr. Boyle or the woman, Caitlan Coleman, who is no longer his wife.

While Justice Doody said the evidence showed that Mr. Boyle had been “cruel, demeaning and controlling” of Ms. Coleman, the judge found her to be a generally unreliable witness partly because of her testimony that she had memory problems and, as she testified, “difficulty seeing reality quite right.”

Ms. Coleman said at the trial that her memory issues were caused by mental health problems she began to suffer over a decade ago.