An RAF pilot missed smashing his aircraft into a bus carrying evacuees at Kabul airport by about 3m (10ft) after the vehicle steered onto the runway as he was taking off.
Wing Commander Kev Latchman revealed military air traffic controllers had been praying for him when they saw his C-17 transport aircraft hurtling towards a line of three vehicles that had taken a wrong turn while trying to reach another evacuation flight.
"At this point, we were doing about 95 knots and they were about a thousand feet ahead of us," he said, speaking from RAF Brize Norton airbase in Oxfordshire.
"We realised that we wouldn't have been able to reject [abort] the take-off, because if I tried to reject then I would have basically... taken out the bus and that doesn't really bear thinking about."
He decided he had to continue with the take-off but then realised that there was not enough distance between his aircraft and the bus to be able to reach the required speed to get airborne - what is known as rotate speed.
"So I said, I think we're going to need to rotate early. And the other pilot agreed. We started to rotate the aircraft about 20 knots earlier than rotate speed.
"We got airborne and we just missed the bus by probably about 10, 15ft."
He said a member of his crew had also put the distance at about 10ft.
Making things even more of a challenge, the airman was having to fly without any runway lights because the power at the airport had failed.
The incident happened on 26 August at a time of acute tensions following a suicide bomb attack hours earlier that had ripped through crowds of people who had been waiting for evacuation flights.
Wing Commander Latchman, who commands 99 Squadron, said he had apparently been "quite calm" while dealing with the potential bus disaster "because you've got no choice".
The close call hit home following a conversation with air traffic controllers.
"We didn't think you were going to make it. We were praying for you," he recalled them saying.
The near miss is just one of a number of stories to emerge from Operation Pitting, the UK's two-week evacuation mission from Kabul airport after the Western-backed Afghan government collapsed in a Taliban takeover last month.
The RAF flew more than 15,000 Afghans, British nationals and others to safety in the biggest evacuation effort since the Second World War.
Aircrew described what it was like to look after plane-loads of desperate Afghans, many who had never flown before and were traumatised after spending days in the heat and crowds outside the airport, waiting to be called forward for a flight.
"The conditions were stark, you know, when you look down the back, you've got anxious faces," said Wing Commander Latchman.
"You had some people who didn't think they were going to leave Afghanistan. So when they got on board the airplane... the relief led to, you know, some spontaneous reactions.
"We had one lady who was spontaneously vomiting continuously all over the airplane because she'd lost her husband the day before and she didn't know what was going to happen."
There was also the hazard to the aircrew of operating out of an airport in a country now under Taliban control.
One pilot described how he had to abort an attempt to land in Kabul on 16 August - the day after the city fell to the Taliban - because crowds of people had surged onto the airfield and swarmed over aircraft on the ground, including a US military plane.
"We could see the airfield was completely overrun," said Flight Lieutenant Neil Franklin, of 70 Squadron, who flies the A400M Atlas transport aircraft.
"There were people on the taxiways, people on the southern apron, and the civilian airliners were covered in people... it was just utter chaos.
As well as the danger posed by crowds, there was the danger posed by terrorist attacks and - on the day Kabul fell - being caught up in the closing stages of the Taliban surge to power.
Squadron Leader Mark Parker, of 70 Squadron, had just dropped off some British troops at Kabul airport on 15 August when the airfield itself was targeted by gunfire and mortars.
He said it was hard to know what was going on.
"The US Marines in the tower called incoming, base under attack," the officer said.
"We had some rounds impacting the ground around our aircraft… And I recall an American helicopter pilot calling mortars inbound and he flew off to have a look at the mortar tube."
The pilot said he was not able to get his A400 plane off the ground straight away as there was too much traffic so they had to wait for about 30 seconds to a minute.
"We took off with some kind of firefight going on in the on the south side of the airport," he said, adding that his aircraft thankfully was not hit.