Canadian Joshua Boyle and his American-born wife Caitlan Coleman got the red carpet treatment when they were flown home after Pakistani security forces rescued them from the clutches of the Taliban in October.

President Trump used the news to herald a new “positive moment in our country’s relationship with Pakistan.”

Reporters clambered for interviews with the former hostages.

Agents began “serious” negotiations to make a Hollywood film of their incredible story.

And the family was invited to meet the Canadian prime minister.

The couple and their three young children, all of whom were born in captivity in Pakistan and Afghanistan, visited Justin Trudeau last month, and tweeted pictures on their Twitter page of their children climbing the furniture in Trudeau’s office.

“Today was a wonderful experience for my family, and Ma’idah Grace Makepeace seemed truly enamored,” wrote Boyle in a caption under a family photo in which Trudeau holds his infant daughter on his lap.

There are several photographs which show Boyle’s two toddler boys and a hijab-clad Coleman, 31, sitting next to the Canadian leader and Boyle himself, sporting a half beard, a crisp burgundy shirt and black slacks deep in discussion with Trudeau.

Boyle, 34, told his Twitter followers that he spoke to Trudeau about the Haqqani network, a group of radical Muslim militants who raped his wife, forced her to miscarry one of their children and imprisoned them in a series of decrepit safe houses for five years.

But less than two weeks after that meeting, Boyle is now back in captivity — this time sporting a bright orange T-shirt as he addressed a Canadian courtroom from an Ottawa-area detention center, where he has been held since his Jan. 1 arrest.

Since their rescue, Boyle, the son of a federal tax judge who once flirted with radical Islam, has become even more of an enigma — adept at dodging tough questions.

“There are a lot of holes in his story,” said Phil Gurski, an Ottawa-based security consultant who used to work for the Canadian Security Intelligence Service, the country’s national intelligence agency. “Why were they in Afghanistan in the first place? There are legitimate questions that need to be answered.”

In October 2012, Boyle and his heavily pregnant wife embarked on a backpacking trip through Ghazni province, one of the most dangerous places in Afghanistan and the stronghold of the Haqqani network, a radical Jihadist group tied to both al Qaeda and the Taliban.

On Oct. 8, they sent their families a message telling them they were in an “unsafe” area of Afghanistan, and then disappeared.

As they arrived in Ghazni, the Taliban had closed dozens of schools and were targeting teachers for death.

“At minimum he has to be the stupidest guy on the planet but clearly there is a track record of being sympathetic to violent jihadists in Canada,” Gurski told The Post.

Boyle’s own father-in-law, Jim Coleman, has also had serious questions about Boyle.

‘Taking your pregnant wife to a very dangerous place…is unconscionable’

“Taking your pregnant wife to a very dangerous place…is unconscionable,” said Coleman in an interview with ABC News last year.

But Boyle was obsessed — fascinated with radical Islam and gripped by a keen sense of adventure.

Boyle, who grew up in a devout Christian family, became interested in radical Islam while still a student at the University of Waterloo. He claims to have edited every Wikipedia entry on radical Islam. Most of his Wikipedia efforts were focused on Omar Khadr, a Canadian and the youngest detainee at Guantanamo. In 2008, Boyle offered to work as a spokesman for the Khadr family, spending much of his time trying to free Omar from detention.

Before marrying Coleman in 2011, Boyle was married to Omar’s outspoken sister, Zaynab Khadr. Their father, Ahmed Said Khadr, was one of Osama Bin Laden’s most trusted lieutenants. Omar was released in 2012 after a decade at Guantanamo and awarded millions by the Canadian government last year after a 2010 Canadian Supreme Court ruling said the country’s intelligence officials obtained evidence from him under torture.

The marriage to Zaynab, who once praised the 9/11 attacks, was shortlived, and the two were divorced after just a year.

Boyle met Coleman, a home-schooled Catholic girl from Stewartstown, Penn., on a Star Wars chat group when they were still in their twenties. They had a brief romantic relationship before Boyle’s marriage to Zaynab and married soon after Boyle’s divorce, according to published reports.

Shortly after they married, the couple traveled through Central America, spending four months backpacking in Guatemala. They claimed that they wanted to help the poor and downtrodden. Their current Twitter page describes them as “Joshua and Caitlan Boyle; freelance do-gooders, hostages extraordinaire, lovers of fine cheese.”

“They saw themselves as helpers of the poor all over the world,” said Denise Bukowski, a Toronto-based literary agent who told The Post she had been in talks with Boyle to represent him in a book and film deal before he was arrested earlier this month.

“He was very keen on making a film about his life,” she said, adding that she has corresponded with Boyle for weeks to discuss his future prospects. “But now, after the charges, I’m not sure what’s going to happen.”

After Central America, the couple flew to Russia, making their way to Kazakhstan, Tajikistan and Kyrgyzstan, according to family members. No one is really sure just why they ended up in one of the most dangerous parts of Afghanistan.

In Bishkek, the Kyrgyzstan capital, they met up with a British cyclist who was also traveling the world.

“I hadn’t thought seriously about traveling to Afghanistan until I started talking to Josh,” wrote Richard Cronin on his blog in the fall of 2012 after meeting the couple at a hostel in the city.

“He was planning to travel there with his wife Caitlan very shortly. Over the course of a conversation that ran long into the night, he planted in my head a strong desire to go. We started talking about Lawrence of Arabia and the explorer Richard Burton. He asked me if I admired these explorers. Of course I did. ‘Wouldn’t you like to be like one of them?’”

Although Boyle assured Cronin that most of the country was relatively safe, Cronin soon turned back after crossing the border, according to his blog posts.

But Boyle and his wife, who was seven months pregnant by the time they crossed into Afghanistan, headed to the most dangerous region in the south where the Taliban and its affiliated terrorist groups often worked with the shady backing of Pakistani intelligence forces.

Although the circumstances of their capture by members of the Haqqani network in October 2012 remain murky, the group appears never to have demanded a ransom for their release, said Gurski, the Canadian security consultant.

The group also denied that its members raped Coleman or forced her to have a miscarriage. Coleman had told reporters after her release that their captors dosed her food with heavy amounts of estrogen in order to bring about the miscarriage of what would have been the couple’s fourth child, a girl they christened Martyr.

But Boyle claims that members of the group raped his wife in retaliation for his refusal to join them. He also said that he helped deliver his children by flashlight and in secret while they were in captivity.

There is no way to corroborate Boyle’s stories. He speaks authoritatively and can be controlling. In an interview with Maclean’s magazine, a Canadian weekly, a reporter noted that he refused to leave the room while his wife was speaking with a reporter. “Check with me before you say any of that on the recording,” Macleans reported that Boyle told her.

After videos emerged of the family in captivity in 2013 and in 2016, the Coleman family worked quietly through diplomatic and military channels to secure their daughter’s freedom. They seemed amazed that after the family was rescued, Boyle refused to allow American doctors to examine his children or board an American military airplane, demanding to be flown to Canada on a commercial airline instead.

At some point, Boyle appears to have converted to Islam, although he refuses to say for sure. He has referred to himself and his wife, who since being released from their captivity has continued to wear a hijab, as “pilgrims” to Afghanistan who were only ever interested in helping the poor.

“The stupidity and evil of the Haqqani Network’s kidnapping of a pilgrim and his heavily pregnant wife engaged in helping ordinary villagers in Taliban-controlled regions of Afghanistan was eclipsed only by the stupidity and evil of authorizing the murder of my infant daughter,” said Boyle after landing in Canada last year. “I certainly do not intend to allow a brutal and sacrilegious gang of criminal miscreants to dictate the future direction of my family, nor to weaken my family’s commitment to do the right thing no matter the cost. In the final analysis, it is the intentions of our actions, not their consequences, on which we all shall eventually be judged.”

But on Monday, Boyle is going to be judged in a Canadian criminal court where he will be seeking bail.

Boyle is facing 15 criminal charges, including two counts of sexual assault and one count of forcibly administering a “noxious substance” — the anti-depressant Trazodone. He is also charged with one count of public mischief in misleading a police officer into believing “that someone was suicidal and missing, causing the officer to start an investigation, and thereby diverting suspicion away from Boyle.”

There are few details of the alleged offences, but court documents suggest there are two alleged victims whose identities are protected by a sweeping publication ban. There is online speculation that one of the victims is his own wife, but no authorities are confirming it and Boyle’s attorney quoted a section of the Canadian Criminal Code in a statement that prohibits the publication of “any information tending to identify any alleged victim or witness.”

For her part, Coleman was quick to defend her husband.

“I can’t speak about the specific charges, but I can say that ultimately it is the strain and trauma he was forced to endure for so many years and the effects that that had on his mental state that is most culpable for this,” she told The Toronto Star in a written statement last week.

On that, and just about everything else, Boyle has been silent, preferring to cast himself as a persecuted, misunderstood and even noble victim of circumstance.

In fact, days before he was arrested in Ottawa where he and his family now live, he quoted Oscar Wilde on his Twitter page, where the handle is @BoylesVsWorld.

“The things people say of a person do not alter a man,” he wrote. “He is what he is. Public opinion is of no value whatsoever.”