The first voice message was from a 16-year-old forward, knee-deep in a trench filled with sewage and panicking in the crowds swarming Hamid Karzai International Airport. “We are desperate,” she cried over the clamor of gunfire and coughing children. “I cannot stand on my feet. I cannot.”

A second message, an instant later, pinged from a defender stuck at a Taliban checkpoint: “I fell down. Our phones are dying.” Other soccer players had been lost in the crush of thousands trying to breach the airport’s Main Gate, where a goalkeeper had fainted. “She’s out of breath,” a teammate shouted.

The Afghan national women’s soccer team was trapped outside Kabul’s airport, sending more than 40 messages in the span of minutes to a former captain thousands of miles away. It was 2:30 a.m. on Aug. 22 in Copenhagen, where Khalida Popal was sitting on her living room floor, the lights off, her back against the wall. The 34-year-old founding member of Afghanistan’s women’s team—an exile since a gunman shot at her a decade earlier and the team’s current program director—was pressing play on another message.

A drawing by one of the women’s soccer team players.

It was from the team’s captain, who had been stuck in sewage for hours: “Tell us what to do!”

Sleep-deprived and wearing the same clothes she had worn since the Taliban reached Kabul, Ms. Popal was on her sixth consecutive day of trying to evacuate the team. Once symbols of the new Afghanistan, they were now running for their lives.

Ms. Popal had few contacts and no wealthy benefactors, and was starting to doubt whether she could get the players into the airport. Several times, she had lost her temper, threatening to block the players for overwhelming her with messages. But what they needed now was encouragement.

“You need to focus. You need to help each other,” she said in an audio message to the group, tightening her chest to stop her voice breaking. “We’re not giving up. There is one more step to the gate.”

The Afghan national women’s team, founded in the early years of the U.S. occupation, had once been feted in the highest halls of American power. Players met then-President George W. Bush in the White House, toured the Pentagon and practiced on the U.S. Embassy’s grounds in Afghanistan, pausing to make way for landing helicopters.

Last month, when the country fell, the women had to save themselves.

Ms. Popal, now in Denmark, was in Kabul traffic in 2011 when a gunman approached her car and fired, narrowly missing her.

Photo: Charlotte de la Fuente for The Wall Street Journal

In the hours after the Taliban seized the capital, some 30 players reached out to Ms. Popal, saying they needed to leave. Several of them had become activists, in a country where playing soccer was a statement of female empowerment that Taliban leaders said was prohibited by Islam. Some had gone into hiding, concealing their trophies in the walls of their homes, after insurgents knocked on their doors. Others had family members who refused to house them because of the risks involved.

All over Kabul, tens of thousands of Afghans were racing to flee the country, among them soldiers, government officials, interpreters, journalists, contractors and embassy staff. At the airport, Western governments were giving priority to their own citizens, residents and Afghans with visas. Prominent Americans called on the military and State Department to evacuate groups for limited spots in the last few days of flights.

All Ms. Popal had was a handful of friends from the women’s soccer world, including the team’s American former coach and her assistant, an ex-Marine.

One player hid her soccer trophies after the Taliban entered the city.

Together, they would attempt to evacuate not just dozens of soccer players, but their families, including children who lacked passports, as well as other female athletes desperate to make the final flights out.

Interviews with players, the small group of people who sought to extract them and Western officials, as well as emails, government memos, encrypted messages, videos and photos from the scene, reconstruct a haphazard rescue effort that ran into danger every step of the way. The athletes were beaten by the Taliban, assaulted amid the crowds, deprived of food, sleep and water for days, and had to push their way past the men they were trying to flee.

Habibi Samangani, a senior Taliban official in Kabul, rejected claims that any women’s soccer players would be targeted. The Islamic Emirate, the Taliban’s name for their new regime, is working to develop policies for “a good environment” for sportswomen, he said. “We don’t have enmity with sports,” he said.

The Taliban’s statements of tolerance haven’t matched their actions since their takeover. In some parts of the country, they have banned girls from school beyond grade six, and forbidden women from leaving home without a male relative.

The team’s journey to the airport hadn’t even begun when Ms. Popal got a video call at 4:05 p.m. on Tuesday, Aug. 17, from a 19-year-old midfield player who appeared on the screen clutching a handgun, her eyes bloodshot.

The young woman, a normally shy Real Madrid fan who kept a poster of Cristiano Ronaldo on her bedroom wall, was gesturing beyond a red-curtained window to Taliban fighters patrolling the road.

“If they come I will shoot myself in the head. I prefer to die than getting caught by them,” she cried. Ms. Popal wasn’t sure what to say. “Trust me,” she said, then recorded another instruction and sent it to all the players she could: “Burn your jerseys.”

To one player after the next, Ms. Popal sent instructions: Delete photos from your phone, and clear your social media.

Photo: Charlotte de la Fuente for The Wall Street Journal

Banned

With a day job coordinating events and fundraisers for with FC Nordsjaelland, a team in Denmark’s Super League, Khalida Popal barely knew many of the women who were beginning to call her for help. But they had all heard of her.

Born in Soviet-occupied Afghanistan, Ms. Popal’s life had tracked the tumultuous four decades for women in her country. At age 9, she and her family had trekked over the mountains into Pakistan after the Taliban seized power and nearly beat her father, a military officer, to death. She returned after the U.S.-led coalition overthrew the Taliban, and began to play soccer with girlfriends in a Kabul schoolyard. On one of their first practice sessions, a group of men climbed the school gates and slashed the ball with a knife.

“They were calling us prostitutes,” she said. “It was then I decided to take football more seriously.”

The earlier Taliban regime had banned women’s sports, repurposing the national soccer stadium into a forum for public beheadings. Then, under the American military, women’s soccer began to blossom. By 2002, Afghan teens were sneaking from home to organize small tournaments, using clothes for goal posts. Soon after, the Defense Department invited players to the Pentagon, where they met Defense Sec. Donald Rumsfeld.

“Playing soccer for the women, it wasn’t just a game,” said Shamila Kohestani, one of the players on that trip. “We were seen as troublemakers, not good, proper girls.”

By 2007, Afghanistan had a national women’s team. The next year, the squad traveled to Jordan for an international tournament, where they lost every game by at least 17 goals. Ms. Popal, unaccustomed to playing on grass or in cleats, kept falling during games, but the results didn’t dent the accomplishment. She teared up during the national anthem: “It was the best moment for me.”

At home, disapproving men would throw rocks at the team’s bus, Ms. Popal said, or visit athletes in their homes to deliver warnings to stay off the field. The Afghan sports federation regularly canceled games and practices, citing bomb threats. The concrete patch the women were given access to was only big enough for seven players a team. Eventually, the U.S. invited the women to play on an embassy lawn, guarded by U.S. troops and shielded from the public by high security walls.

Members of the Afghan women's national soccer team, in red, played the International Security Assistance Force’s team in a friendly match at ISAF headquarters in Kabul in 2010. The Afghan team won, 1-0.

Photo: Altaf Qadri/ASSOCIATED PRESS

“These were all the risks that women took just to play soccer,” said Ms. Kohestani.

In 2011, Ms. Popal was stuck in Kabul traffic when a gunman approached her car and fired, narrowly missing her but seriously wounding her driver. She spent two nights sleeping in a graveyard before fleeing the country.

The Taliban insurgency was growing, but so was the profile of the team. Refugee players who played professionally in Germany, the U.S. and Scandinavia mentored the women at training camps abroad. By 2016, the team had a corporate sponsor, the Danish sportswear brand Hummel International; a new coach, Kelly Lindsey, a former defender on the U.S. national team; a strength and conditioning coach who had worked with NASA; and a new slogan, “Together unbreakable.” Ms. Lindsey has since left the team.

Kelly Lindsey, coach of the Afghanistan women's soccer team, pictured in 2019.

Photo: Rob Harris/Associated Press

By the evening of Sunday, Aug. 15, team members were staring through their windows at Taliban fighters celebrating on the streets. Some women had already gone into hiding, and one had seen her home torched. Each after the other, they began to message Ms. Popal, who was watching the news from Copenhagen with rising terror.

“Will I ever play football again?” the team’s striker wrote Ms. Popal. A string of crying faces and broken heart emojis flooded into the chat. “There is no hope for living any more, especially for us as football players.”

‘A matter of urgency’

On Monday, as Kabul awoke to its first day of Taliban control, Ms. Popal hatched out a plan on a Zoom call with Ms. Lindsey; Kat Craig, a London-based human rights lawyer; and Jonas Baer-Hoffman, general secretary of the international players union, FIFPRO, in the Netherlands. First, identify the players most at risk—they came up with four, including some who had spoken out against the Taliban—then bombard governments, lawmakers and soccer officials, especially in nations known for accepting refugees.

“Please consider as a matter of urgency…any assistance you are able to offer these courageous women,” read an email that Mr. Baer-Hoffman sent to dozens of government officials, soccer world contacts, German ministries, Belgian and Canadian officials, and members of the European parliament. Mr. Baer-Hoffman and the team thought the odds didn’t look good, but they hoped they’d be able to get a handful of players out.

Afghans gathered around Kabul’s airport on Aug. 20.

Photo: wakil kohsar/Agence France-Presse/Getty Images

A forward, one of the four chosen to leave, texted Ms. Popal with a dilemma: Her parents were in hiding and she couldn’t leave Afghanistan without her siblings, aged 6 and 11, neither of whom had passports. Overnight, unable to sleep, Ms. Popal agonized over how she could possibly select only some players to escape. Voice messages from panicking athletes were landing on her phone, minute after minute.

“Stop spamming me,” she said in a memo to one group of players. “If you continuously send your voice crying, I will block you.”

By Tuesday morning, armed Taliban fighters had already knocked on several players’ doors, sending the women into hiding. Neighbors were informing on them, several were convinced. The players were struggling to find family members who would risk sheltering them, and the militants had reportedly seized sophisticated electronic surveillance technology left behind by America.

To one player after the next, Ms. Popal sent instructions: Delete photos from your phone, and clear your social media.

Ms. Popal took a break from playing soccer to look at her phone at a local field in Denmark.

Photo: Charlotte de la Fuente for The Wall Street Journal

That night, she decided they should try to get all the players out—not just the four.

Shortly after dawn on Wednesday, Ms. Popal messaged the team captain with an order: Create a single list of all the players. By 10 a.m., they had made a group chat of all the teammates they intended to evacuate, 45 in all.

“I cannot give you any promise. And don’t expect a lot,” she said. “Let’s just try our best and stay together.”

The distraught messages that flooded back frightened her.

“The only hope that is left is you,” one said.

Another came from the captain, a 21-year-old usually known for her on-pitch aggression and cool head, whose voice was quivering in her message: “There is just one light, and that is your voice.”

Responses were now beginning to fall into Mr. Baer-Hoffman’s inbox from governments and some of the world’s biggest sports organizations. They were all sympathetic yet noncommittal.

The National Football League’s players association had lobbied U.S. Vice President Kamala Harris’s office to consider the women’s case. The National Hockey League’s players association was in touch with U.S. officials. The U.S. State Department, the Belgian government and German lawmakers had each said they would add the women to lists of people to potentially evacuate. Yet none of them had sent the commitment the women needed: a document that could get them past the U.S. troops guarding the airport gates. In some places, even U.S. green card holders were struggling to get through.

Then came word from a government the team hadn’t initially considered. Australian soccer star Craig Foster, who had discussed the case with a sports-rights group, had called foreign minister Marise Payne to explain the situation: “We’ve got a whole heap of high-profile female athletes here,” he told her. After a flurry of paperwork, with dozens of visa applications submitted over hours, an Australian government document acknowledging the players’ visa applications landed on Ms. Popal’s phone.

It wasn’t much, but it represented some rough provisional agreement. Mostly, it was a document to show at the gates.

“Good news,” she wrote to the team at 7:10 p.m. “One of the countries accepted.”

Crowds gathered near the Kabul airport’s Abbey Gate on Aug. 23.

Photo: maxar technologies/Reuters

Ms. Popal didn’t tell them which country, and the athletes didn’t ask. The only focus now was to navigate the chaos around the airport, a gauntlet of Taliban checkpoints, frantic crowds and jittery troops trying to juggle the fast-changing demands of the half-dozen different allied governments participating in the airlift. “Wait for my call before you move,” Ms. Popal messaged the group.

To the airport

Just after midnight on Thursday, the captain, unwilling to wait, led a small group to the airport. The players spent a full day elbowing through the crowds. On Friday, the women returned, defeated.

Saturday morning, around 5 a.m. in Copenhagen, Ms. Popal was passed out, phone on her chest, when a call jolted her awake. She needed to hop on a Zoom call with the Australians working on their case.

At 6:43 a.m.—9:13 a.m. in Kabul—Ms. Popal ordered the team to set out, now finally bearing the documents she hoped would convince the troops to allow them through the gates: a letter from FIFA, soccer’s global governing body, attesting that the women were soccer players, and the Australian visa submission.

Put your passports in your underwear, she warned them; bring food, water and power packs for your phones; carry a red scarf to use as a flare in the crowd; and if the Taliban stop you, cry. Then tell them that your husband will be irate if you don’t join him in the airport.

“What about our families?” the captain asked Ms. Popal. She couldn’t leave her mom, dad and baby sister.

The players’ siblings, children and parents didn’t have paperwork and should stay back, Ms. Craig, the lawyer, told Ms. Popal. But Ms. Popal wasn’t willing to make that call.

“Take them with you to the airport,” she told the team. “Spend some more time with them. I cannot guarantee that they will let your families in. But try your chance.”

The rendezvous point was the Panjsher gas station, just over 200 yards from the airport. The soccer players and their families—now more than 100 people—converged there, in veils, Covid face masks and sneakers. Some wore their Afghan national team backpacks emblazoned with their jersey numbers, stuffed with essentials to start a new life. Their instructions were to get to the North Gate. But when they arrived, it was closed, with no one there to meet them.

“When are they coming?” a player texted Ms. Popal, who then spent more than 12 hours of confused calls trying to answer the question. In Sydney, it was the middle of the night when Mr. Foster woke to a call for help and walked downstairs to phone the foreign minister.

“I’ll deal with it,” the foreign minister said.

New instructions reached Ms. Popal: Team members, who had fallen asleep on the ground, needed to get to the airport’s Abbey Gate. Immediately, Ms. Popal’s phone was exploding with questions about where the Abbey Gate was. Dozens of messages demanded more clarity. And other Afghan athletes started calling, too—a karate competitor and male soccer players—saying they had heard she could rescue them.

Eight thousand miles away, in her Houston home study, Haley Carter, an ex-Marine and Ms. Lindsey’s assistant coach, was calling her military contacts to help her create a digital map to guide the players to Abbey Gate. The players shared their locations using GPS on their phones so Ms. Carter could track them as they trudged through the swelling masses of people. But as the crowds got thicker, Ms. Carter watched the pins diverge. They were getting separated.

‘You’re sending us to the Taliban’

Hours after telling the team to go to Abbey Gate, Ms. Popal relayed new instructions to the players: They now needed to head to the Main Gate—immediately—where the Australians were waiting.

“You’re sending us to the Taliban,” a player protested in a voice message. “They’re shooting at people there.”

Soon, some players were stuck between checkpoints of Taliban fighters cracking whips in the crowd and firing guns into the air.

The team had split into groups, and many were struggling to push exhausted relatives through the crowds, inching to the Main Gate. New instructions came yet again: They now needed to double back to Abbey Gate. They filtered into another thousands-strong crowd of mostly men pressing forward. Through the night, the players were jolted in an angry throng of elbows. Some were groped.

A photo taken by one of the team players from the sewage ditch.

“You have to sustain the crowd and be a witness of your own abuse,” said the captain, who was struggling to hold onto her family. The throng was heaving, people furiously fighting for space as gunshots clattered above their heads.

There was only one way to bypass the multitudes swarming Abbey Gate: by trudging through a labyrinthine sewage ditch, flowing with human waste and filling up with people trying the same brutal shortcut.

The first group of players began to climb down into the ditch, jostling past other groups, inching shoulder-to-shoulder for hours and struggling not to fall. Those with families were carrying children to keep them from being trampled. The 16-year-old forward got separated and began to hyperventilate. Others slipped out from the crowd, giving up and returning home.

“It’s not possible,” said one voice memo to the group. “There’s no air to breathe.”

It was now 2 a.m. on Monday in Copenhagen, and Ms. Popal sensed the rescue effort was failing. One group said they were trapped in the sewage, while others complained they couldn’t find the ditch. Several said they had been injured and were struggling to walk.

Ms. Popal knew the team had to push and recorded the message she hadn’t wanted to send: “I’m sorry but you now have to leave your families if you can’t move forward.”

Military forces put blue check marks on players’ hands to signify their paperwork had been checked.

The players began to mouth tearful farewells to parents and siblings. The captain had been separated from her dad—who had been beaten by Taliban guards while carrying her baby sister—and her mom with no chance to say goodbye. She pushed on, shouting commands to her teammates in the throng, or sobbing in audio messages to Copenhagen through thirst and hunger.

“It’s your last chance,” she told herself. “No turning back.”

Finally, shortly before 10 a.m., the team’s captain and nine other players reached a small contingent of overwhelmed Swedish troops.

“Footballers! Australia!” screamed the 19-year-old, waving the red scarf she was carrying. The captain held up a water bottle to catch their attention.

The Swedes lifted them over a concrete wall, draped in razor wire, one after the next, into the airport. They didn’t even look at the players’ documents.

“We’re in,” the captain texted Ms. Popal.

“In where?” she replied.

“The airport.”

‘Be strong’

The captain, now moving through the packed compound, found Lance Cpl. Kareem Nikoui, a 20-year-old Californian who had joined the U.S. Marines last year after graduating from high school.

The captain explained their predicament. Lance Cpl. Nikoui stepped into the crowd and hoisted other players as they made it to the gates. Over audio messages, those players guided yet more teammates to their location.

Marine Corps Lance Cpl. Kareem M. Nikoui.

Photo: U.S. Marines/Associated Press

They needed to wrap up fast, Ms. Popal told them. Rumors were circulating of a coming attack. In Washington, President Biden had warned that Islamic State terrorists would likely strike.

In all, 86 soccer players and their families ultimately made it into the airport. They boarded transporter planes to the United Arab Emirates, a staging ground for their uncertain new life in Australia.

Before embarking, the captain took a video call from her mother. “Goodbye my child,” she told her. “Take care now, be strong and never forget you have God.”

The captain and the goalkeeper who had fainted were among the teammates who made it out, as was the 19-year-old midfielder who had threatened to shoot herself, along with her parents and two young siblings.

The 16-year-old forward had to leave four family members at the airport. “We didn’t have time for our emotions. We had to move faster and act faster to survive,” she said.

More than a dozen players from the youth and women’s teams didn’t make it out. On Thursday, Ms. Popal called off the evacuation. It was too dangerous for the players still left in Kabul, she warned. That afternoon, an Islamic State suicide bomb, followed by gunfire, struck Abbey Gate, killing Lance Cpl. Nikoui, 12 other Marines and nearly 200 civilians.

Afghan women’s players and others on the plane leaving Kabul.

Write to Drew Hinshaw at drew.hinshaw@wsj.com and Joe Parkinson at joe.parkinson@wsj.com