In the days leading up the Servus Calgary Marathon, organizers were resigned to the conclusion there would be no medals for participants at the finish line at Sunday's race.
In fact, marathon organizers sent an email to that effect early last week, telling runners not to get their hopes up.
But with the hard work of hundreds of people at five organizations in two countries and in three time zones, a medal miracle occurred, organizers said.
"Honestly, it's like magic that they were here in time," said Kirsten-Ellen Fleming, executive director of the marathon and of Run Calgary.
"I think people were just so excited. It was such a great day, and then to have that surprise at the finish line was extra special."
Early last week, race organizers heard they had about a one per cent chance of receiving the 7,140 medals on time.
They'd ordered the medals early this year — in January — worried about global shipping challenges, but the vessel carrying them couldn't dock when it arrived in Vancouver on April 8, organizers said in a news release.
Due to backlogs, the ship had to wait an additional six weeks after reaching port before being added to the queue to be unloaded.
Behind the scenes, workers at Global Container Terminal Canada, which operates GCT Deltaport, hadn't given up on digging out the shipment.
"Once we knew what was happening and where the container was, we did everything in our control to make it happen," said Chris Ng, vice-president of marketing and sales from GCT Canada.
"The vessel ops group strategically planned the unloading of this ship in a way to ensure it was prioritized and everyone from the terminal VP to the team worked to get the container off early Saturday morning."
From there, U.S.-based broker Leslie Jordan and a Vancouver-based trucking company, CTC, managed to get the medals through customs and to a sorting facility, which isn't typically open on Saturdays.
While at Stampede Park on Saturday setting up for the race, Fleming continued to receive the updates.
"It's 12 hours from Vancouver to Calgary, you know, if you're a straight shot in a vehicle, let alone a big truck with 700 kilograms on it, and so we knew it was going to take wings to get us the medals overnight," she said.
Enter WestJet. One of the Calgary-based airline's employees, Sarah Barton, is also a longtime marathon volunteer. She helped to co-ordinate getting the medals onto a late-night flight.
Even the cargo workers who were needed to unload the plane stayed late to help after the flight was delayed.
"When the opportunity presented itself to help expedite the arrival of the Calgary Marathon medals, we wanted to do anything possible to ensure participants had medals to celebrate with at the finish line," said Morgan Bell, WestJet spokesperson, in a statement.
From there, Fleming and operations director Jon Bird drove the medals in two trucks to the race venue at Stampede Park just hours before the runners were set to arrive.
Surprised volunteers arrived to find the boxes at 5 a.m., then started unpacking and sorting the medals, the final step in a whirlwind journey.
It was a happy surprise for both them and the racers, Fleming said, as medal selfies filled up social media by Sunday afternoon.
"Medals for the marathon, there's obviously greater problems in the world … so I just wasn't expecting it. It was really, really amazing to see how many people went above and beyond to help us make race day extra special," Fleming said.
"It was a literal race to the finish line."