At the very last he stumbled, he almost fell. But ultimately Mo Farah took it all in his stride to win yet another gold.

There was the sticky heat and dehydration that necessitated an early water stop, the trio of Kenyans who conspired against him and the tangle of limbs that nearly tripped him on the final lap. More than that, Farah shrugged off the turmoil that has engulfed him off the track ever since 3 June, the date of the Panorama documentary that made strenuously denied doping allegations against his coach and mentor Alberto Salazar and his training partner Galen Rupp.

At the end of it all, he stood in a rapidly emptying Bird’s Nest soaked in sweat and cloaked in relief, clutching a union flag and drinking in the fact he had secured his sixth gold medal in a world championships or Olympic Games. It is on the track that he has looked happiest of late. And so it proved here.

Sealing victory with a trademark surge in a 54 second final lap, Farah crossed the line bathed in joy in the relatively fast time of 27min 1.13sec.

He said later that it had been his toughest ever final as the Kenyan trio who ultimately finished second, third and fourth – Geoffrey Kamworor, Paul Tanui and Bedan Muchiri – pushed him to the limit. A block of red and black at the front of the field for most of the race followed by Rupp and Farah, they knew they had no chance against the reigning champion’s devastating kick if it went to a sprint finish. So they tried to control the pace, starting slowly and then ratcheting it up.

But Farah is now too canny, too controlled, too experienced to allow himself to bullied. He and Rupp, who finished fifth, worked together to stay in touch.

The race began slowly, with the three Kenyans controlling the pace after moving to the front on the third lap. Farah, for his part, paused to take on water as they slowly ramped up the pace and the pressure.

Farah had feared before the race they would try to burn him off or tire him out for the 5,000m to come and they signalled their intention to work together from the start. Slowly they tried to turn the screw.

Rupp made way for Farah with seven laps to go, who moved into third behind Kamworor and Tanui. At 8,000m Farah lay second behind the former with Rupp, who ultimately fell away to finish fifth, still at his side.

The Kenyan efforts were not quite enough. When Farah hit the front with 600m to go, as he has so many times before, it was like watching a replay of a fondly familiar movie. We knew how this one would end, even with the added twist of that stumble when he was caught by Kamworor shortly after the bell.

Throughout a summer in which he has been under relentless pressure off the track over doping allegations aimed at Salazar that forced him to leave his family and his coach behind in Portland and head for Font Romeu in the French Pyrenees, Farah’s team have continually underlined his singular focus and self-belief.

Ever since he returned to the track in Lausanne last month, it is as though he has been using the storm raging around him – which also took in the revelation that he missed two drug tests in the run up to the London Olympics – as fuel to his inner fire.

The British Athletics performance director, Neil Black, went further after arriving in Beijing this past week, revealing he believed Farah had used the furore to focus even harder and run even faster.

At 32, Farah has begun to feel athletes such as Kamworor snapping at his heels – literally in the case of that final lap clash – but still stands imperiously atop his discipline.

If there was relief for Farah in overcoming his recent travails off the track, there was also redemption on it. It was in the Bird’s Nest stadium where he suffered one of the biggest regrets of his career, when he failed to qualify for the 5,000m final at the 2008 Olympics. “I remember coming back home with my head down, knowing I could have got to the final but I didn’t,” he said on the eve of this race.

That bitter disappointment helped mint a newly motivated Farah and kickstart a chain of events that led to Oregon and Salazar, to Daegu, to London, to Moscow and now back here.

The truth of the fiercely disputed allegations levelled against his mentor will come out in the months to come as the United States Anti-Doping Agency complete their investigation and UK Athletics complete their own review of their relationship with the maverick coach.

Farah and Salazar have been pictured together this past week for the first time since the allegations surfaced but the Cuba-born coach has remained integral to Farah’s training regime, communicating almost daily with the British Athletics camp about his progress and feeding in ideas.

Now the seemingly invincible Farah will focus on a historic double to match that in Moscow two years ago.