For the briefest moment, it looked like Vladimir Putin's back was against the wall.
His one-time ally and warlord, Yevgeny Prigozhin, led a stunning 24-hour uprising that represented the greatest threat to the Russian strongman's power in two decades.
But just as Prigozhin claimed his Wagner mercenaries were 200 kilometres out of Moscow, he mysteriously backed down.
Despite calling his old friend's insurrection a "stab in the back", Putin suddenly agreed to drop the charges against him and his men.
"There was a higher goal — to avoid bloodshed, to avoid internal confrontation, to avoid clashes with unpredictable results," a Kremlin spokesman said.
One man has emerged as a key player in ending this wild saga: Belarusian dictator Alexander Lukashenko.
The Kremlin says Lukashenko personally offered to step in and negotiate peace because he "has been acquainted with Mr Prigozhin for a long time, at least 20 years".
Russian President Vladimir Putin's decision to launch a full-scale war against Ukraine has backfired catastrophically.
Under the terms of the agreement, Wagner soldiers who mutinied will return to fight for Russia in Ukraine, while Prigozhin will go into exile in Belarus.
The deal places three of Europe's most dangerous men in a precarious arrangement with each other.
Putin, who vowed to destroy Prigozhin just hours before allowing him to leave the country, now lives with his unpredictable enemy just across the border.
And it will be up to Lukashenko, whose position rests entirely on Putin's favour, to contain him.
Catch up on all the news on the Wagner group's return to Ukraine in our blog
Lukashenko is Belarus's first and only president since the former USSR state became an independent nation in 1991.
A 39-year-old moustachioed farm manager, Lukashenko promised Belarusians he could save their paralysed economy and run off the criminal gangs who tormented the fledging nation.
He won with 80 per cent of the vote.
But he soon earned himself the nickname "Europe's last dictator" for his tight control of the economy and Belarusian media, and his brutal repression of critics.
Lukashenko's regime was also accused in 2001 of using "death squads" to murder four political opponents.
Despite maintaining close relations with Russia, extracting favours in the form of state loans and cheaper energy deals, he always managed to keep Putin at arm's length.
In 2014, when Putin illegally annexed the Ukrainian territory of Crimea, he declined to recognise it as Russian territory.
And the following year, in what Moscow later called an "unpleasant episode", he refused to allow Russia to set up an air base on Belarusian land.
"Putin and Lukashenko do not get along," Emily Ferris, a Russia expert for the Royal United Services Institute, said.
"For years, Lukashenko had vocally resisted Russia's attempts to bring Belarus closer into its orbit."
But in 2020, Lukashenko found himself in desperate need of help.
After claiming a landslide victory in a sham election that handed him a sixth term in office, he suddenly faced a huge uprising against his power.
Putin flooded the streets with his security forces and replaced Belarusian journalists with pro-Kremlin propagandists.
Lukashenko got to stay in power. But this time, that power was an illusion.
Entirely dependent on Putin's support to stay in office, Lukashenko started referring to the Russian strongman as his "elder brother".
But behind the scenes, they were more like "reluctant authoritarian bros", according to Vladislav Davidzon, a fellow at the Atlantic Council's Eurasia Centre.
"Putin doesn't actually want to be stuck with the aged, incompetent, brutal, and increasingly erratic Lukashenko," he wrote in 2021.
"Every new instance of brutal escalation by his security services further increases Lukashenko's dependence on the Kremlin, which continues to discreetly search for ways to transition away from him on its own terms."
But the following year, Putin launched a disastrous invasion of Ukraine, and realised he needed all the friends he could get.
When Putin sent his troops into Ukraine, he thought he had a huge advantage.
Lukashenko allowed him to use Belarus as a staging ground for the attack, so his men could pour across the border and make a quick 225-kilometre dash to capture the capital, Kyiv.
We now know that this manoeuvre ended in abject humiliation for Putin.
His soldiers met surprising resistance from Ukrainian forces, who stalled them in the villages outside the capital and ended Putin's dream of capturing the nation in a few days.
Even as the war became fiercer and messier and more protracted, Lukashenko was steadfast in his support of his ally.
Last year, Lukashenko gave Russia 65,000 tonnes of ammunition, about 100 Soviet-era tanks and 20 armoured vehicles, according to independent Belarusian monitors.
If he throws in his lot with Vladimir Putin, Europe's "last dictator" may watch in horror as his men stop their march towards Kyiv, turn around and head home to overthrow their despotic ruler.
Many Russian casualties are sent straight to Belarusian morgues and hospitals.
And earlier this year, Lukashenko gave what might be the greatest concession of all: He agreed to host Russian nuclear weapons on Belarusian soil.
But despite his seemingly unending capitulations, experts say Putin was always looking for more.
"The Kremlin will likely attempt to coerce Belarus into further integration," US think tank the Institute for the Study of War said earlier this year.
"Belarus may be pressured into more concessions under the rubric of defending … [it] from claimed Western military and terrorist threats."
In March, Lukashenko travelled to Moscow for talks with Putin, referring obliquely to "problems and some misunderstandings" in their relationship.
"Who's to blame? Putin and I need to be able to discuss and solve those problems that should not mar our relationship," he said.
When he returned to Moscow in May for further meetings with Putin, he suddenly fell ill and had to be rushed to hospital, fuelling conspiracy theories.
"Blood purification procedures have been conducted," Belarusian opposition leader Valery Tsepkalo said.
"The orchestrated efforts to save the Belarusian dictator aimed to dispel speculations regarding Kremlin's alleged involvement in his poisoning."
Lukashenko vanished from public view for weeks, before re-emerging for a string of events in which he looked pale and a bandage seemed to move from his left hand to his right.
"If someone thinks I am going to die, calm down," Lukashenko yelled at reporters, insisting he was simply recovering from a virus.
"I'm not going to die, guys. You'll have to struggle with me for a very long time to come."
But just a month after he seemed weaker than ever, Lukashenko stunned almost everyone by saving Putin from the brink.
As an angry Putin issued threats on live TV and Prigozhin vowed to die for his cause on social media, Lukashenko was apparently working quietly behind the scenes to end the crisis.
He says he spent "the whole day" locked in talks with the Wagner chief and "came to an agreement on the inadmissibility of unleashing a bloodbath on the territory of Russia".
When the deal was done, Prigozhin hopped into the back of a black SUV in Rostov-on-Don and waved to the crowds as he drove towards his new life in Belarus.
"It is notable that it wasn't Putin or any of his aides that were able to negotiate [a deal] and had to let Lukashenko do that," Peter Zalmayev, director of the Eurasian Democracy Initiative, told France 24.
"That in itself is an indication of Putin's weakness, and it will undermine, not necessarily his hold on power in the near future, but his reputation."
Mr Zalmayev noted that Lukashenko was a "pariah" in Europe, with few friends and little influence.
"It shows Putin's desperation that he was only able to do it through an intermediary," he said.
The last few days have up-ended the carefully maintained power structure in Putin's world.
But as former British prime minister Winston Churchill said, it will take a while to see which Kremlin insider emerges victorious.
"Kremlin political intrigues are comparable to a bulldog fight under a rug," he once said.
"An outsider only hears the growling, and when he sees the bones fly out from beneath, it is obvious who won."
We acknowledge Aboriginal and Torres Strait Islander peoples as the First Australians and Traditional Custodians of the lands where we live, learn, and work.
This service may include material from Agence France-Presse (AFP), APTN, Reuters, AAP, CNN and the BBC World Service which is copyright and cannot be reproduced.
AEST = Australian Eastern Standard Time which is 10 hours ahead of GMT (Greenwich Mean Time)