Image copyright AFP via Getty Images Image caption The trial of former Afghan hostage Joshua Boyle has been watched around the world

A few months after Joshua Boyle, his American wife Caitlan Coleman and their three children were rescued in October 2017 after being held captive in Afghanistan, Mr Boyle was arrested by Canadian police and charged with assault, sexual assault and forcible confinement. On Thursday, after a lengthy trial, a judge dismissed all the charges.

In 2012, Mr Boyle, 36, and Ms Coleman were kidnapped by the Haqqani militant network while backpacking in Afghanistan. Their rescue, following a five-year hostage ordeal, made headlines around the world.

The pair had married in 2011 and had three children together while in captivity.

In December 2017, Mr Boyle was arrested in Ottawa, Canada and charged on 19 separate counts.

He pleaded not guilty to all the charges, which were related to alleged assaults against his now estranged wife.

Here is what you need to know about the trial.

What did the judge's decision say?

In his decision, read in an Ottawa courtroom, Ontario Court Judge Peter Doody raised issues with the credibility of both Mr Boyle's and Ms Coleman's testimony.

"I do not believe her, just as I do not believe Mr Boyle," he said in court.

The two gave very divergent accounts during the trial of the events that led up to Mr Boyle's arrest.

The judge said the evidence was largely circumstantial and that prosecutors ultimately did not prove the charges beyond a reasonable doubt.

Mr Boyle did not comment on the decision on Thursday.

Speaking on his behalf, his lawyer Lawrence Greenspon told journalists that "Mr Boyle and his family are very happy with this decision".

The trial, which began in March, faced delays due to legal wrangling over whether defence counsel would be allowed to cross-examine Ms Coleman with respect to the couple's sexual history.

Image copyright AFP/Getty Images Image caption Joshua Boyle's case was heard in an Ottawa courthouse

Canada's criminal code limits the ability to introduce a complainant's past sexual activity as evidence in sexual offence proceedings, with some exceptions.

What did we hear during the trial?

Ms Coleman says she was the victim of Mr Boyle's abuse during their captivity - abuse that continued after their rescue.

She said that once in captivity, their relationship, which both conceded had long been volatile, worsened and that Mr Boyle grew violent.

She claimed he would hit, bite, spank, punch and strangle her.

For his part, Mr Boyle and his defence team painted Ms Coleman as an emotionally unstable and sometimes violent woman unable to control her "fits of anger".

Mr Boyle also denied threatening, controlling or abusing her in captivity though he conceded he'd had to physically intervene during her fits of anger.

Image copyright FBI handout Image caption The couple were captured in Afghanistan in 2012

He also said that activities like spanking were a consensual part of the couple's sex life.

What happened when they returned to Canada?

According to Ms Coleman, the abuse stopped for a while but picked up again as the family began to settle down to their new lives in Ottawa.

She described an increasingly disturbing domestic life in the short period between their rescue and Mr Boyle's arrest.

He became more controlling, she said, dictating how she should act with family and media covering the story of their hostage taking, and limiting her access to funds.

She submitted to the court a handwritten list of rules she says he gave her.

Ms Coleman was to address her husband and young children as "Sir" or "Madam", lose a certain amount of weight each week and exercise a certain amount each day, and satisfy him sexually.

She also said she was sexually assaulted by Mr Boyle during that period.

Mr Boyle denied much of what Ms Coleman claimed, saying he was never violent, did the bulk of the childcare and never restricted family finances.

His lawyer suggested that Ms Coleman concocted the assault allegations in order to get sole custody of their children.

What led to Mr Boyle's arrest?

One night in late December, Ms Coleman said Mr Boyle had confined her to their bedroom.

Image copyright AFP via Getty Images Image caption Caitlan Coleman is now living in the US

It made her feel panicky, she said, because it reminded her of times in captivity.

In Mr Boyle's testimony, he said the couple did have an argument because she had fallen asleep and left the children unsupervised in their apartment. He denied any violence.

Ms Coleman said she took her and her children's passports, and cash from his wallet, pulled on several pairs of socks and a sweater, and ran upstairs and knocked on the neighbour's door.

There was no answer. So she left her apartment building and went into the street.

Employees at a nearby pizza restaurant let her use their phone to call her mother, who was visiting from the US.

Meanwhile, Mr Boyle told the court he noticed his wife had left without her coat and was worried about her in the frigid weather, so called the police.

She got a taxi to her mother's hotel and shortly after, Ottawa police arrived. Police arrested Mr Boyle not long after his wife explained her version of events to the authorities.

With files from Brigitte Pellerin and Dani-Elle Dubé