The baby wasn't expected for another month, maybe six weeks. But American hostage Caitlan Coleman was going into labor, and there was nowhere to turn for help.

The Taliban guards outside her dirt-floored prison room had forbidden the pregnancy, so she had concealed her growing belly under flowing robes. Coleman and her husband, Canadian Joshua Boyle, had no access to childbirth instructions or medication in the militant safe house where they were held in Pakistan's lawless tribal area. In preparation for the birth, Boyle had managed to stash away a pair of beard scissors and a box of matches he could use to sterilize a needle, in case he needed to attempt emergency surgery.

Coleman, who was kidnapped with Boyle during a backpacking trip to neighboring Afghanistan in 2012, had already endured more than two years of deprivation, assault and the ever-present possibility of summary execution at the hands of the Haqqani network, the feared Taliban faction known for attacking Westerners. Her first child, a boy, was born shortly after they were taken captive. A second pregnancy was terminated after a guard secretly added chemicals to their food, she and Boyle believed.

Now her third pregnancy was coming to an accelerated end. The contractions hit hard and fast. She and Boyle sat their toddler son down with a plate of stockpiled food to keep him occupied. The room grew dark as a thunderstorm obscured what light filtered in through the room's small window. Several hours after the labor began, a baby boy, premature but alive, emerged into a laundry bin. It was July 23, 2015.

The couple's euphoria quickly gave way to fear. Coleman said her husband worried about how their captors would respond when they learned they had been deceived. Some guards were sympathetic; others were capricious and cruel.

Behind those concerns, an even larger set of questions pressed into Coleman's mind. Would this new baby, like their first son, spend his entire childhood in captivity? Even if they were released, would the scars of imprisonment debilitate them? And, perhaps most urgently, could she survive what she described as the intensifying abuse by her husband?

How a woman from a small town in Pennsylvania ended up in a South Asian militant compound, giving birth in captivity, is a story of subjugation, suffering and, ultimately, resilience. In multiple interviews this spring, Coleman, 33, described a "double imprisonment" - by one of the world's most brutal militant groups and a husband who tormented her.

"The whole captivity with the Haqqani network, obviously it was horrible," she said. "But in my mind, it paled in comparison to what was going on in my personal life."

Now back in the United States, Coleman is attempting to create a stable home for her four young children while a Canadian court tries their father on 19 counts of abuse, including sexual assault and unlawful confinement. The outcome of the case, which has focused attention on the couple's intimate life and their conflicting depictions of each other, is likely to determine whether Coleman retains sole custody of the children.

Through his lawyers, Boyle, 35, has denied the charges against him, accusing his wife of erratic behavior and characterizing some of her allegations as consensual acts. He declined to comment for this article.

Coleman said she is speaking out to tell her own, unfiltered account of what occurred during those five difficult years. It amends and, in some cases, contradicts some of the statements she made following the family's release in 2017, which she says Boyle coerced.

The Washington Post could not verify many aspects of Coleman's account, but it appears to fill in gaps in what had been a perplexing public narrative of the couple's captivity - one that the Western officials who worked for years to secure their release found implausible and even suspicious.

The decision to travel to one of the world's most dangerous places, when Coleman was already six months pregnant, raised questions about whether they harbored support for the Taliban. According to a former FBI agent assigned to the couple's case, who spoke on the condition of anonymity to speak freely, officials set those concerns aside while they worked to explore lead after lead to track them down.

Still, he said, "no one just goes hiking in Afghanistan."

When the couple climbed into a taxi at Tajikistan's border with Afghanistan in early October 2012, it marked the culmination of years of planning by Boyle, who had developed a fascination with the Taliban.

It was also a product of what Coleman said was prolonged psychological programming and abuse by Boyle.

Growing up in tiny Stewartstown, Pennsylvania, Coleman was the home-schooled daughter of a onetime NASA scientist. A fan of fantasy and sci-fi, she was 16 when she first encountered Boyle in an online Star Wars forum in 2002. She was smitten. He was charismatic and sure of himself. He seemed to know a lot about the world. He was her first kiss, she said.

The son of an Ontario lawyer who later became a tax judge, Boyle had also been home-schooled before attending a Mennonite high school. In college, he studied journalism and told people he wanted to be a war correspondent. He was drawn to groups he saw as misunderstood, including the Taliban.

Boyle has spoken publicly of his prolific activity as a Wikipedia editor, which Canada's National Post has reported exceeded 60,000 edits and focused on areas including terrorism, Star Wars, erotica and Nazi Germany.

The relationship was tempestuous from the start. Coleman said Boyle's insults became more severe, and his attempts to control her gradually grew more extreme.

After a brief stint living together in Toronto in 2007, the couple broke up. Boyle then became a spokesman for the family of Omar Khadr, a Canadian who was the youngest inmate at the U.S. military prison at Guantanamo Bay, Cuba, when he arrived there at 15. Khadr, who spent a decade at Guantanamo before being transferred to a Canadian prison and released in 2015, became a cause celebre for critics of America's tactics in the wake of the Sept. 11, 2001, terrorist attacks. He is now free and received more than $10 million in compensation from the Canadian government in 2017.

Boyle was briefly married to Khadr's older sister Zaynab, who attained notoriety in Canada for defending the 9/11 attacks.

After his divorce from Khadr, Boyle resumed his romance with Coleman. In 2011, the couple took a backpacking trip through Central America, where they married. According to Coleman, Boyle began dictating what she should wear, whom she talked to and what she said in emails after their wedding.

Back home in Pennsylvania after the trip, she began divorce proceedings, but the couple reunited the following spring.

Coleman's family remained wary of Boyle. They described his views as conspiratorial and self-aggrandizing. Her father, Jim, said he was "kind of a weird dude." Boyle's mother described her son to a reporter as smart, proud and "very odd."

Jim Coleman said Boyle told him that the West had misrepresented the Taliban and that he planned to travel to Afghanistan to help villagers.

Coleman and her family objected, and Boyle agreed to compromise. They would backpack in Central Asia but skip war-torn Afghanistan.

It was only much later, when FBI agents came to search their home after the kidnapping, that Coleman's mother learned from an ultrasound image found hidden in a drawer that her daughter had been pregnant when she left.

In interviews after her release, Coleman and Boyle said they shared a desire to visit Afghanistan. The truth, she says now, was more complicated. Once they got to Central Asia, where they camped and stayed in hostels, it became clear that Boyle intended to continue on to Afghanistan.

Coleman told herself it might be worth making the trip to keep her marriage together. They had booked return tickets for early December, in time to have the baby back home.

As she grew increasingly unwell as her pregnancy progressed, she felt less equipped to resist his plan. Boyle also kept their passports during their travels, Coleman said, and doled out only small amounts of money.

"Josh never held a gun to my head and said, 'Go to Afghanistan or die,' " she said. "But I was told I didn't have a choice, and I was already at a point in our relationship where I felt like I didn't."

After spending a few days in Mazar-e Sharif and Kabul, the couple prepared to make their way to the city of Ghazni, south of the capital. According to the plan Boyle shared with Coleman, it would be the jumping-off point for a journey deeper into Afghanistan's south, the Taliban's birthplace.

On Oct. 10, 2012, they hired a taxi on the outskirts of Kabul. When they reached Wardak province - with the capital's embassies and foreign military commands well behind them - "we knew we were crossing into Taliban territory," Coleman said.

About an hour later, a masked man wielding a Kalashnikov waved them to the side of the road. Shouting and pointing his rifle at the foreigners, he forced the driver into the trunk and, a teenage sidekick in tow, took the wheel. They pulled off the highway.

The militants barked questions at Boyle - which neither he nor Coleman could understand - but mostly ignored her. In the back seat, she was paralyzed by shock. "It was sort of like, my mind trying to catch up with what's happening," Coleman said.

The couple later came to believe that their captors, who would spend the next few days shuttling them between safe houses, were local criminals in the process of arranging their sale to the Haqqani network.

Soon Coleman and Boyle were taken east into Pakistan, where foreign hostages were often held, out of the reach of U.S. and NATO forces.

Boyle, however, told his wife he was confident they would be freed once the militants learned of his connection to Khadr, who had been captured during a 2002 firefight with U.S. forces in Afghanistan, she said. Several weeks into their captivity, they were separated for what Coleman was told would be a brief period so their captors could question Boyle. She wouldn't see him again for seven months.

"It took a while before I was able to come to grips with the fact that I was going to have the baby in captivity," Coleman said. "I thought, 'Well, I'm pregnant, they know I'm pregnant, everybody knows I'm pregnant. There's no conceivable way that they would keep me once the delivery date gets close. They just wouldn't.' "

But in what would become a familiar pattern during captivity, she was first told she would be taken to an English-speaking doctor to deliver the baby. Then, she was told there would be an interpreter if the provider didn't speak English. In the end, neither happened. A midwife who delivered the baby spoke no English but treated Coleman with kindness, giving her hand-me-down baby clothes and dispatching the guards to buy baby supplies.

She was the last woman Coleman would see for nearly five years. Women couldn't be trusted, the guards told her. They were too sympathetic to her plight.

Coleman said she was sexually assaulted by guards between the births of her first son, Najaeshi Jonah, in January 2013 and her second child in July 2015. She declined to give more details but said the couple believed the attack may have been punishment for accusing the militants of terminating a pregnancy after her first child was born.

Taliban representatives told reporters that they intended to use Coleman and Boyle as leverage to secure the release of militant prisoners in Afghanistan. The Afghan government wasn't interested, and there was little officials in Washington - who for years didn't even know where the couple was being held - could do.

Coleman and Boyle named their second child, born in the clandestine delivery in July 2015, Dhakwoen Noah.

The couple debated how to break the news to the guards. They identified one who seemed more sympathetic, called him into the room and produced the child.

"His eyes went really big," Coleman said.

After that, Boyle and Coleman asked a more senior militant if they could have more children. His response: "Have as many children as you want. The more children, the more money I'll make on ransom," Coleman said.

Coleman struggles to articulate why she and Boyle continued to have children in such a situation. They had both wanted a big family. And even as their interactions became more strained, she said Boyle insisted on having sex.

A third child, Ma'idah Grace, was born in August 2017.

Children gave Coleman purpose: to provide them "just a little bit of light" in the darkest of circumstances. But motherhood in captivity was a constant struggle. Only one of nearly two dozen militant compounds where they were held had running water. Typically, they were kept in a room with dirt floors, sometimes with a bathroom attached.

While the guards rarely struck the children, they seemed indifferent to their well-being. Some of the guards were friendly, asking Coleman and Boyle - usually in English - what they wanted to eat. Others provided meals that were far from sufficient, and even the children went hungry.

Intermittently, Coleman and Boyle managed to get a few toys and books for the children. For a while, they were allowed to have pens and notebooks. Toward the end of their captivity, Coleman made a couple of stuffed cats for the children. The guards burned them.

To pass the time, Boyle and Coleman spent hours writing in their notebooks or playing imagination games with the children. Boyle liked to talk about world events, she said. In moments of tedium, he would read and reread labels from packaged food they had been given. Later, their captors gave them a DVD player and some videos.

With little to occupy them, the children were lethargic and had trouble sleeping. Occasionally, the guards would take Najaeshi to the yard to play. Dhakwoen, more fearful, never ventured outside.

As their imprisonment approached the five-year mark, Coleman's concerns about her children intensified. If their captors were willing to hold them this long, "who's to say we won't be here for 10 years?"

Coleman also worried about the effect of her husband's behavior on the children.

Toward the end of their captivity, the couple barely spoke. His insistence on her subservience grew more extreme, she said. He prohibited her from looking at him directly. He made her call him sir. Then, he made her call their boys sir, too, a sign of her status in the family. She said he bit her, slapped her and joked he would like to kill her. He said he couldn't stand the sight of her and forced her to wear a face-covering burqa all day.

In what she described as the darkest period, Boyle limited her contact with the children, allowing her to touch Ma'idah only when she was breast-feeding, and banished her for entire days to a shower stall.

In August 2017, President Donald Trump threatened to withhold U.S. aid to Pakistan for harboring "the very terrorists" U.S. troops were fighting in Afghanistan. "That must change immediately," Trump declared.

After years of failed attempts to locate the couple or broker their release, American officials finally got a lucky break that fall. An intelligence analyst, reviewing aerial footage of western Pakistan in an unrelated mission, got a fleeting glimpse of a woman and several children who briefly ventured outside in a militant compound. Officials assessed it might be Coleman, setting in motion urgent consultations.

The Pentagon mobilized a team of Navy SEALs for a potential rescue mission, but officials grappled with questions about the troops' safety. Diplomats redoubled their pressure on officials in Islamabad, which would be loathe to risk the embarrassment of an American military operation on Pakistani soil, to get the couple released.

At the same time, Coleman and Boyle's captors informed them that they would be moved to yet another safe house. The guards piled the adults in the back of a car and put the children - who had been sedated - up front. Through a section of window visible from the back, Coleman and Boyle could see that they were being taken, for the first time, out of Pakistan's tribal zone and into the government-controlled central region. It was a hopeful sign.

But when the vehicle was stopped at a checkpoint, Coleman and Boyle could hear a commotion. The militants attempted a quick getaway, and gunfire erupted as the car raced away. When the vehicle's tires were shot out, their captors got out and fled. In the back of the car, Coleman and Boyle sat motionless, afraid to draw attention to themselves. "We had no idea" who was chasing them, Coleman said. "In that part of the world, it's like the Wild West."

When they saw that the men outside were dressed in security uniforms, they shouted out for help. The Pakistani forces broke the vehicle's rear window, and the couple clambered out. Their long imprisonment was over.

For some U.S. officials, the sudden unraveling of Boyle and Coleman's captivity brought little clarity to what many U.S. officials had long believed: that parts of the Pakistani government had links to the Haqqani network and may have known about the kidnapping. Officials in Islamabad deny any connection.

In the following days, as U.S. and Canadian diplomats scrambled to activate what had been a detailed plan for reintegrating the family back into normal life, officials were taken aback by Boyle's behavior. When they arrived at an air base in Islamabad, where a host of U.S. and Canadian officials had gathered to send them off, Boyle refused to get on a U.S. military aircraft that was supposed to take them to Afghanistan and then to Germany for medical treatment. He prevailed on Canadian diplomats to arrange a commercial flight to Canada, Western officials said.

Coleman said she went along because the initial travel plan seemed to support Boyle's long-standing theory that the U.S. government wanted to imprison him. Her father, who had worked closely with the U.S. government for so long to free her, was irate. But after so many years with Boyle in charge, Coleman didn't challenge Boyle's decision.

In Canada, Boyle's behavior grew worse, Coleman has testified to a court in Ottawa. She declined to discuss events that are the subject of her court case but has testified that Boyle hit, slapped and choked her while they were in Canada.

The court made public what the prosecution says was a list of "rules" handwritten by Boyle for his wife, dictating that she care for the children in a specific way, lose a certain amount of weight, sleep nude and "plan interesting sex minimum of twice a week." She was to receive "chastisement" if she failed.

In a handful of media interviews in the months following their release, Coleman appeared robotic and withdrawn. She told reporters she had shared Boyle's desire to travel to Afghanistan, that she couldn't remember how they were kidnapped and that the miscarriage she and Boyle believed was caused by her captors occurred much later than it did - all assertions she has since recanted.

She now says Boyle dictated her public statements, a claim corroborated by a journalist from the Canadian magazine Maclean's who interviewed the couple after the release.

"That's another thing that's hard for people to understand," Coleman said. "But the truth is that somebody who's been beaten down for so long, you don't really think about a way out."

Coleman says she was pushed to flee the night of Dec. 30, 2017. In court testimony, Coleman said she ran from the apartment where they were staying following a violent altercation in which Boyle hit her and said he would confine her to their bedroom.

Boyle was arrested shortly afterward. When a Canadian family judge several months later gave Coleman permission to take the children to the United States, she left the same day.

In court, Boyle's attorneys have questioned Coleman's credibility, raising doubts about her fitness as a parent. Boyle alleges she hit the children - a claim she denies - and cited a 2007 incident in which she admitted pushing him on a Toronto subway platform.

The trial was delayed for several months while Judge Peter Doody considered what information could be aired about the couple's sexual life. Their history of consensual acts of bondage, sadomasochism and domination adds an additional complication to the prosecution's attempt to demonstrate abuse.

While defense arguments are not set to begin until early September, possibly including testimony by Boyle, his lawyers have suggested that Coleman has made up episodes of alleged abuse or conflated them with willing acts.

In early July, Boyle's parents sat next to their son as the court heard graphic details of his and Coleman's intimate activity.

"There was no point in Ottawa when I found BDSM to be anything but revolting," Coleman testified via video link from the United States, seeking to draw a line between things she may have desired, things she may have consented to and things she says Boyle forced her to do.

During the period in which the alleged abuse occurred in Canada, Coleman has acknowledged in court that she and Boyle continued to have consensual sex in an attempt to conceive another child. Another daughter, Joy, was born after Coleman arrived in the United States in 2018.

Twice a day over the past year, Coleman has corralled her two toddlers, Dhakwoen, now 4, and Ma'idah, 2, and the baby, nearly a year old, put on their shoes and hats and loaded them into a hulking double stroller to get to the bus stop so Najaeshi, 6, could attend kindergarten.

Since their arrival in the United States in July 2018, Coleman and her children have settled into a small house. The Washington Post is not identifying the location because of Coleman's safety concerns.

Taking care of four children on her own is not easy. Coleman attended college for a year before she was kidnapped and hopes to pursue a career in psychology when the children are older.

"Caity comes back and she's penniless," Jim Coleman said of his daughter, who is seeking a divorce.

The Canadian government provided some assistance to the family, including housing, medical care and a social worker, but Coleman struggled back in the United States to find a doctor and a therapist. Social services didn't seem equipped to address what had happened to her and the kids.

In the initial months after their release, the children were fascinated by all the new things around them - light switches, sinks. During captivity, they rarely saw cars. As they drove down the highway shortly after arriving in Canada, Dhakwoen seemed overwhelmed as he tried to count each one out the window. "Another car. Another car. Another car," he said.

Memories of the kidnapping come up in small ways that make Coleman wonder how much of the ordeal still weighs on them. If Najaeshi sees a watermelon, for example, "He'll say, 'Oh, we used to eat watermelon when we were prisoners,' " she said.

Najaeshi knows other children have not had the same experience. Sometimes he'll ask: Why were we prisoners? "I try to give simple answers because I just don't feel like he's at a place where he needs to understand a lot of the big, heavy stuff," she said.

The boys are seeing specialists in childhood trauma.

The floor of the family's basement playroom is strewn with dozens of toys: robots, racecars, a play kitchen. Dhakwoen, shaggy blond curls framing his face, shows off his mastery of one game before discarding it and turning to the next. Ma'idah, with her dark, searching eyes, is most interested in whatever her older brother has chosen.

In October, it will be two years since they reentered the world. Slowly, she has reclaimed the parts of her that had been nearly erased.

But it's difficult to look ahead while the trial - and the possibility Boyle will reenter their lives - hangs over her.

"There are still days that I feel very, very fearful that I'm going to lose all of this," she said, "and one day I'm going to be back in that place."

The Washington Post’s Julie Tate contributed to this report.