Coded messages, satellite images, desperate hordes, a rising terror threat, and rapidly closing evacuation window. Herald senior journalist Kurt Bayer reveals the extraordinary inner-workings of New Zealand's mercy mission to Kabul, described as a 'digital Dunkirk'.
They were in the wrong location.
A photo dropped into the group chat on an encrypted instant messaging service.
It showed a litter-strewn path running alongside a prison-style razor wire fence, where hundreds of Afghans were crammed.
"This is where we want them to be," said the contact – their lifeline to freedom.
"We will ID them. Then swim them across the canal and take them under a fence. It's been working."
A satellite image followed. It showed the airport from above, dusty brown and grey, a wiggly green highlighted line showing them the new spot.
The group, clutching printed "NZ" signs, slipped inside a laminate protector, grabbed the children, single bags, and started pushing their wheelchair-bound elder through the throngs outside Hamid Karzai International Airport.
Hundreds of military planes had been making evacuation flights over the last 10-plus days, rushing at-risk Afghans, former interpreters, and other civilians out of the country which had just fallen into Taliban hands after 20 years of war.
They were desperate to get inside the airport, to the safety of Kiwi soldiers, and a "freedom flight" out, to escape Taliban revenge killings, or to join family members back in New Zealand.
Desperate. Along with thousands of others.
The Ministry of Foreign Affairs and Trade (MFAT) advised New Zealand visa holders that moving in groups of family and friends might prove more effective.
The capital Kabul's airport was about 5km from the city centre. Gates opened daily at 7am. Get there early, they were told, and to expect large, and potentially volatile crowds.
Keep phones charged and on hand. Only one item of luggage per passenger, weighing no more than 10kg. Take water, food, medication, and expect delays in temperatures soaring into the mid 30Cs. Prepare to wait. Some had camped out for 72 hours before being allowed through.
Working to an agreed total withdrawal by August 31, Taliban seem to have accepted US conditions and allowed generally safe passages through checkpoints for passport holders and Afghans with valid visas.
But it wasn't always that straightforward. Many militants on roadblocks couldn't understand English, or demanded passports, which many still didn't have. Others wantonly beat passersby, fired shots into the air, causing panic and stampedes. Several deaths had been reported. An Afghan soldier would be killed in a firefight.
One group even told family members in New Zealand that gas was also used on the crowds.
And many locals were chancing their arm with forged documents and tenuous, unverified claims to coalition connections.
Some without any paperwork would even attach themselves to groups who did, hoping to sneak through in the rush.
Two Afghan journalists, fearing that they would be targeted in revenge attacks for their work in recent years, heard it was working, and gave it a go. It nearly cost them their lives.
After scoping out the airport, and its various entrances being used by US soldiers and other coalition forces – North Gate, Abbey Gate, Baron Hotel Gate, East Gate, South Gate – they discovered who were being let inside and how.
But when they tried to get closer, without any papers, the Taliban fighters would beat them back, using rifle butts, sticks, iron bars.
The next day, they returned with signs saying, "British Citizen", holding them high, battling the crowds, and yelling to soldiers behind the wire.
Even though some got through with papers, they failed.
On the third day, the industrious and increasingly anxious pair overheard some in a group talking on a cellphone. They were New Zealand visa holders, talking to a family member back in Auckland. They were holding "NZ" signs and had children and women, including an elderly lady in a wheelchair, among them.
The Auckland family member was in direct contact with MFAT officials, who were liaising on the ground.
They were told to be near the Abbey Gate and the nearby Baron Hotel Gate, which were being guarded by British troops.
Photographs sent via the NZDF evacuation team inside the airport showed them next where they needed to be: across a sewage-filled canal northeast of the Baron Hotel Gate.
If they got there, NZDF staff could identify them and whisk them under the wire.
"It's been working," they were assured in a WhatsApp message, adding that the elderly were being respected by the Taliban.
However, they were advised not to show their Kiwi passports at a checkpoint by Abbey Gate.
"Talibs don't like it," one official told them.
It was an arduous, and painfully slow mission for the group. It involved lowering the woman in the wheelchair 1.8m down into a canal filled with half a metre of filthy sewer water and lifted up on the other side.
One man got lost in the throngs and got separated. He wouldn't make it through.
The area was soon becoming another choke point. Crowds pushed again the airport perimeter fence, topped with razor wire, while soldiers tried to calm them down.
The Americans would ignore the "NZ" signs. They needed to be held aloft, so the New Zealand team could see them and tell the US soldiers that they were okay, they needed to be let through.
It wasn't a perfect system, MFAT officials knew. There appeared to be a lot of luck involved, good and bad.
But around 30 people made it through the same way the day before. Anyway, it was the best they had. A Royal New Zealand Air Force (RNZAF) C-130, scrambled from Whenuapai the week before, had made it in and out already. Others were being herded onto "partner nations" planes – the Americans and Australians.
More satellite images of the airport, showing planes on the ground, and the perimeter wire, with highlights of where they needed to be were sent.
Screenshots and images were sent back and forth, manoeuvring them into the right place. Details were important.
Cellphone connections and networks, however, were dodgy, with reports that either the Taliban or the US – maybe both - were using jammers in the area so close to the tarmac.
The NZ signs weren't working any more. Others without visas had caught on and were trying the trick themselves.
New code words were sent out.
"If you have a pen, can you write TAUPO on the paper in big letters please. It will make it easier to find you," the group chat was told.
Tension rose as the Kiwi soldiers couldn't pick them out in the crowds. It was mayhem all around. Warning shots had them ducking intermittently.
More detailed images and maps were sent, moving them around the canal.
Contact with family members helping back home become more intermittent as cellphones kept cutting out. Calls wouldn't go through.
It was too crowded. They risked being split up and cut off.
They were told to go to another spot, by a bridge. They found it and were told to stay put. The next sweep past by NZDF soldiers should find them.
Photos of the right people were sent.
A new codeword was sent: CUP.
Comms went quiet. Minutes ticked like hours.
Then, some news. Five got through, including the woman in the wheelchair.
They were met by members of the 19-strong NZDF team and taken to an evacuation centre. They were given water and health checks before being processed and flown out of Afghanistan later that day on a military plane.
They were bound for the United Arab Emirates. They didn't know where they were headed, only that eventually, they would make it to New Zealand. The ordeal was over. And they may never see their homeland again.
Others weren't so lucky.
Former interpreters and other at-risk Afghans who had worked with the New Zealand forces, police, and other Kiwi missions over the two decades-long war, had to wait for their paperwork. For some, they'd been trying for years.
It included a group of 37 Afghan civilians who helped the New Zealand Provincial Reconstruction Team (NZ PRT) in the Bamiyan Province - including interpreters, carpenters, electricians, mechanics, cleaners, and female kitchen workers.
While they hid in Kabul – a city of around five million – there were reports of Taliban militants armed with blacklists, going door-to-door, looking for people just like them – so-called collaborators who had worked with the enemy.
And although Taliban leadership had told the world's media that there would no reprisals or revenge killings, they were sceptical.
One former translator, who the Herald will call Ali, felt himself losing his mind waiting for his visa to come through.
On August 15, when Kabul fell to the rampant Taliban, who strode into the Presidential Palace without a shot fired in anger and claimed control of the country, Ali cautiously ventured into the streets.
He found armed gunmen setting up checkpoints, doing patrols. He darted down side-streets, knowing he now had to stay underground.
Every night, he would run to a new safe house. Friends would shelter him. He would lie awake and listen to the gunfire.
"Terrified, mate," he would message in the early hours of the morning.
"No idea when we will be evacuated. We don't have time to waste on bureaucracy.
"It's coming on [my] mind that they are looking for me.
"I talked to a friend today who managed to get to the airport. It took him three days ... your life is not guaranteed, there is no safe passage.
"It's not normal ... it's 1.20am and I'm writing this."
The evacuation window was closing. US President Joe Biden said all his troops – who were in control of the airport's interior – would be gone by August 31. The Taliban warned that they better be.
Finally, on Thursday, the interpreters got the news they had been waiting for – some of them, like Ali, had been trying for years. Their emergency visas had been granted.
"It's the best news, mate," Ali messaged, so excited that he'd started googling New Zealand and researching it on Wikipedia.
"I'll let you know once we get through," he vowed.
Officials told them to head for the airport on Friday.
Ali started deleting his social media, wiping his history clean for any Taliban scrutiny at checkpoints. All documents other than his visa paperwork would need to be destroyed.
But hours later, his dreams were put on hold. A major terrorist threat had emerged.
New Zealand, Australia, Britain and the US had intelligence that terror group ISIS-K (Islamic State-Khorasan Province) - an affiliate of Islamic State active in Afghanistan and Pakistan, violently opposed to the Taliban – were planning an imminent attack on the airport.
MFAT warned New Zealanders and visa holders trying to flee to stay away.
"Do not travel to Kabul Airport ... There is an ongoing and very high threat of terrorist attack," New Zealand Government's Safe Travel advice said.
Ali and his group were told to hold tight. More instructions would follow.
Another ex-NZDF translator in touch with the Herald, who had also been fighting for months for a visa, decided to try his luck.
With a group of other visa holders, they tried the various gates. They were as crowded and chaotic as in previous days.
Turned back, they left at 3pm.
Just hours later, the attack happened. Two suicide bombers - one at the airport's Abbey Gate and a second explosion at the nearby Baron Hotel, where New Zealand visa holders have been congregating in previous days – killed dozens before at least one gunman opened fire on the crowds.
At least 170 civilians are said to have been killed – along with 13 US military troops.
The scenes were horrific.
The two Afghan journalists, trying to attach themselves to fleeing Kiwis, were blasted beneath sewage water in the canal with "dead bodies all over us".
Covered in blood, they retreated to their homes in Kabul. Their contact back in Auckland told them, and the others he'd spent countless hours through the night helping over the last fortnight, that he couldn't help anymore. His conscience couldn't take it if anything had happened to them.
If it wasn't already over, it spelled the end of the New Zealand evacuation mission on the ground. The last RNZAF C-130 flight safely got out the day before - along with all NZDF personnel.
And when Prime Minister Jacinda Ardern faced the press on Friday, she admitted: "We did not get everyone out."
Just what happens now to those left behind, remains uncertain.
The US and UK are completing their last flights from Kabul but time is running out.
The resumption of commercial flights resuming out of HKIA, once the dust settles, remains a possibility, if not a remote one.
Thousands are trying to escape by foot. But the journeys are arduous, dangerous, and uncertain. The Taliban controls all of the country's border crossings, including at Spin Boldak on the south-western Pakistani border, and many are being turned away.
With the NZDF's mission now over, the final number of people evacuated is yet to be confirmed.
Before the last flight, 276 people had been flown out - not including another 100 on the last flight, although it's not clear how many were destined for New Zealand.
But for those estimated 200 people left behind, like Ali, life in Afghanistan remains highly uncertain and volatile.
"It was devastating to wake up to the news the evacuation had ended. There must be an option for us," he says.
"Otherwise ... I do not know what we will do, but it will not be good."