Inside State House in Harare, Robert Mugabe was in the tightest spot of his 37-year rule. Tanks were on the streets and troops had occupied the state broadcaster, from where the army had announced it had taken control of Zimbabwe.
Mugabe, 93 years old but still alert, remained defiant. The only leader the country had known since independence was refusing to quit.
At a tense meeting with his military top brass on November 16, the world's oldest head of state put his foot down: "Bring me the constitution and tell me what it says," he ordered military chief Constantino Chiwenga, according to two sources present.
An aide brought a copy of the constitution, which lays out that the president is commander-in-chief of the armed forces.
Chiwenga, dressed in camouflage fatigues, hesitated before replying that Zimbabwe was facing a national crisis that demanded military intervention.
Mugabe retorted that the army was the problem, according to the sources present. Then the beleaguered president indicated that perhaps they could find a solution together.
The meeting marked the start of an extraordinary five-day standoff between Mugabe and Zimbabwe's supreme law on one side, and the military, his party and Zimbabwe's people on the other.
The generals wanted Mugabe to go, but they also wanted a peaceful "coup," one that would not irreparably tarnish the administration aiming to take over, according to multiple military and political sources.
The president finally accepted defeat only after he was sacked by his own ZANU-PF party and faced the ignominy of impeachment. He signed a short letter of resignation to parliament speaker Jacob Mudenda that was read out to lawmakers on November 21.
Mugabe, who had run Zimbabwe since 1980 and overseen its descent into economic ruin while his wife shopped for luxury goods, was gone.
The country erupted into ecstasy. Parliamentarians danced and people poured onto the streets in their tens of thousands to celebrate a political downfall that sent shockwaves across Africa and the world.
To many, the end of Mugabe had been unthinkable only one week before.
Reuters has pieced together the events leading up to Mugabe's removal, showing that the army's action was the culmination of months of planning that stretched from Harare to Johannesburg to Beijing.
Drawing on a trove of intelligence documents from within Mugabe's feared Central Intelligence Organisation (CIO), Reuters reported in September that the army was backing Emmerson Mnangagwa, then vice president, to succeed Mugabe when the time came.
The report detailed how Mnangagwa, a lifelong friend and former security chief of Mugabe, might cooperate with Mugabe's political foes in order to revive the economy. It caused furore in Zimbabwe's media and political circles.
Bitter rivalry intensified between Mnangagwa and Grace, Mugabe's 52-year-old wife, who also hoped to take over as president and had the backing of a ZANU-PF faction known as G40.
In early October, Mnangagwa said he had been airlifted to hospital in South Africa after a poisoning attempt in August. He pointed no fingers - but he didn't need to.
Grace's swift response was to deny it and accuse her rival of seeking sympathy; she belittled him as nothing but an employee of her husband, according to a report in the state-run Herald newspaper.
As the pressure built, Mugabe became increasingly paranoid about the loyalty of army chief Chiwenga, a career soldier and decorated veteran of Zimbabwe's 1970s bush-war against white-minority rule.
Mugabe's spies, who permeated every institution and section of society in Zimbabwe, were warning him the military would not accept Grace as president.
"Mugabe is very worried of a coup," one intelligence report, dated October 23, said. "Mugabe was openly told by senior CIOs that the military is not going to easily accept the appointment of Grace. He was warned to be ready for civil war."
Reuters reviewed the document, and hundreds of other intelligence reports dating back to 2009, before the coup took place. The documents come from within the CIO, but Reuters could not determine for whom they were written. The CIO is split into factions, some pro- and some anti-Mugabe.
In late October, Mugabe summoned Chiwenga to a showdown, according to another of the documents, dated October 30. It said Mugabe confronted the army chief about his ties to Mnangagwa and told him that going against Grace would cost him his life.
"Chiwenga was warned by Mugabe that it is high time for him to start following. He mentioned to Chiwenga that those fighting his wife are bound to die a painful death," the intelligence report said.
At the same meeting, Mugabe also ordered Chiwenga to pledge allegiance to Grace. He refused.
"Chiwengwa refused to be intimidated. He stood his ground over his loyalty to Mnangagwa," the report said.
Reuters put questions about this exchange and other aspects of this article to Mugabe's spokesman, George Charamba. In an enigmatic text message dated November 23, he replied: "Enjoy Reuters copy. Goodnight."
Two spokesmen for Chiwenga declined to comment.
After another tense meeting with Mugabe on November 5, Chiwenga left Harare on a pre-arranged official trip and travelled to China, which wields significant influence as a major investor in Zimbabwe.
A day later, Mugabe sacked Mnangagwa as vice president and purged him from ZANU-PF, the liberation movement that Mnangagwa had served since his youth and for which, as a young militant caught bombing a train, he had nearly been executed.
For the generals, Mugabe had gone too far. The military immediately activated a "Code Red" alert, its highest level of preparedness, a military source said.
Moments after Mnangagwa was ousted on November 6, the security details assigned to him and his house were withdrawn, according to a statement he issued later. He was told his life was in danger.
"Security personnel, who are friendly to me, warned me that plans were underfoot to eliminate me once arrested and taken to a police station," Mnangagwa said in a November 21 statement. "It was in my security interest to leave the country immediately."
From Harare, he managed to escape over the border into neighboring Mozambique, where he caught a plane to China, according to one source familiar with his movements. There he met up with Chiwenga, the source said.
Reuters could not confirm the account; but an intelligence report from November 13 indicates that Mugabe suspected some of his generals of preparing to overthrow him from China.
"A number of generals are now in China ready to plot Mugabe's ouster with Mnangagwa," the report said. It was not clear which generals, and whether their travel to China was authorized.
Mugabe's spies suspected old allies had turned against the ageing president. An intelligence report, dated October 30, said Beijing and Moscow both supported regime change out of frustration at Zimbabwe's economic implosion under Mugabe.
"China and Russia are after change," the report said. "They are after change within ZANU-PF as they are sick and tired of Mugabe's leadership."
"The two countries are even ready to clandestinely supply arms of war to Mnangagwa to fight Mugabe."
Neither China's Defence Ministry nor Foreign Ministry responded to a request for comment. The Foreign Ministry had previously said Chiwenga's visit was "a normal military exchange mutually agreed upon by China and Zimbabwe."
Reuters sent written requests for comment to the Kremlin, the Russian Defence Ministry and the Russian Foreign Ministry. None of them responded.
China has long taken an interest in Zimbabwe, having supported Mugabe's forces during the liberation struggle. After independence it developed connections there in mining, security and construction.
Russia has also had ties to Zimbabwe since the early 1980s, and in 2014 a Russian consortium entered into a partnership to develop a $3 billion platinum mining project in the country.
Chiwenga's trip to China culminated in him meeting Chinese Defence Minister Chang Wanquan in Beijing on November 10.
Two sources with knowledge of the talks told Reuters that Chiwenga asked if China would agree not to interfere if he took temporary control in Zimbabwe to remove Mugabe from power. Chang assured him Beijing would not get involved and the two also discussed tactics that might be employed during the de facto coup, the sources said.
Reuters could not establish whether Mnangagwa met Chang.
Having got wind of the talks in China, Mugabe summoned his still-loyal police commissioner, Augustine Chihuri, and his deputy, Innocent Matibiri, to detain Chiwenga on his return to Harare, government and security sources said.
The pair assembled a squad of 100 police and intelligence agents. But the plot leaked and Chiwenga supporters managed to pull together a counter-team of several hundred special forces soldiers and agents as their commander's plane approached.
Some were disguised as baggage handlers, their military fatigues and weapons hidden beneath high-visibility jackets and overalls, one security source said.
Realising they were outnumbered and outgunned, Chihuri's police team backed down, allowing Chiwenga to touch down without incident, the security source said.
Mugabe's spokesman did not comment on the incident.
Two days later, Chiwenga and a group of military commanders demanded a meeting with Mugabe at his official State House residence in Harare, an ornate colonial villa complete with stuffed leopards and thick red carpets, according to a government source.
They said they were "very alarmed" at the firing of Mnangagwa and told Mugabe to rein in his wife and her G40 faction, whom they accused of trying to divide the military, according to the government official, who was present at the discussions.
"What do you think should be done?" Mugabe demanded of the soldiers as he sat slumped in an armchair.
The generals asked him to give assurances that they too would not be purged. Mugabe's response was lukewarm, the government source said. Chiwenga told Mugabe he would be making his concerns about the G40 faction public.
Hours later, Chiwenga summoned reporters to the military's main barracks near Harare to issue a statement.
"We must remind those behind the current treacherous shenanigans that, when it comes to matters of protecting our revolution, the military will not hesitate to step in," he said, reading from a prepared text.
The following afternoon, Reuters reported six armoured personnel carriers heading towards the headquarters of Mugabe's Presidential Guard on the outskirts of Harare. It was unclear whose command they were under.
At the time, the city's residents were on edge but still unsure what it all meant.
At around 6 p.m. on November 14, Mugabe's motorcade headed to his private "Blue Roof" residence, a heavily fortified compound in the capital's leafy northern suburb of Borrowdale.
Meanwhile, social media buzzed with pictures of armored vehicles driving along roads to Harare, sparking frenzied speculation about a coup.
Increasingly concerned, Grace put in a call shortly after 7 p.m. to a cabinet minister asking to get WhatsApp and Twitter shut down, according to one source familiar with a recording of the conversation.
The minister, whose identity Reuters is withholding for safety reasons, replied that such a move was the responsibility of state security minister Kembo Mohadi.
"No-one will stand for a coup. It cannot happen," said Grace, commonly referred to as Amai, which means Mother, according to a source who heard the recording.
Mugabe's voice is then heard on the line: "As you have heard from Amai, is there anything that can be done?"
The minister gave the same response, about the responsibilities of state security, and the line went dead, the source said.
Mohadi declined to comment.
Two hours later, two armored vehicles rolled into the Pockets Hill headquarters of the Zimbabwe Broadcasting Corporation (ZBC), according to ZBC sources.
Dozens of soldiers sealed off the site and stormed into the studios where they accosted staff, snatching their phones and halting programmes. State-owned ZBC, widely seen as a mouthpiece for Mugabe, switched to broadcasting pop music videos.
Mugabe's inner circle, nearly all of them G40 loyalists, had no idea what was under way, according to four sources familiar with their conversations.
Information Minister Simon Khaya Moyo called Defence Minister Sydney Sekeramayi to ask if he had any information about a possible coup. Sekeramayi said no, but tried to check with military chief Chiwenga.
Chiwenga told Sekeramayi he would get back to him. According to the sources, Chiwenga never did.
Moyo remains in hiding and was unavailable for comment. Sekeramayi declined to comment.
As ministers in the G40 faction tried frantically to work out what was going on, Chiwenga's men closed in on Mugabe's compound.
According to a source briefed on the situation, Albert Ngulube, a CIO director and head of Mugabe's security detail, was driving home around 9.30 p.m. after visiting Mugabe. He met an armoured car on Borrowdale Brooke, a side road leading to Mugabe's house.
When Ngulube confronted the soldiers and threatened to shoot them, they beat him up and detained him, the source said. Ngulube was later released, but had suffered head and facial injuries, the source added.
Spokesmen for Chiwenga and Mnangagwa declined to comment. Reuters was unable to contact Ngulube.
Other G40 ministers were also picked up by soldiers. Finance minister Ignatius Chombo was found hiding in a toilet at his house and beaten before being detained at an undisclosed location for more than a week.
On his release on November 24, he was hospitalized with injuries to his hands, legs and back, his lawyer told Reuters, describing the army's behavior as "brutal and draconian."
Soldiers used explosives to blow the front door off the house of Jonathan Moyo, the main brains behind G40, according to video footage of the house seen by Reuters. Others burst through the front gates of the residence of local government minister Saviour Kasukuwere, another key Grace supporter.
Both men managed to escape to Mugabe's residence. Contacted by Reuters shortly after midnight in the early hours of November 15, Kasukuwere was audibly stressed. "I can't talk. I'm in a meeting," he said, before hanging up.
For another week, Mugabe clung on to the presidency as Chiwenga and his forces tried to engineer a peaceful, and quasi-legal, exit for the long-serving leader.
But as parliament began impeachment proceedings on November 21, Mugabe finally gave up. After 37 years in control, during which much of his country fell into poverty, his letter of resignation said he was stepping down out of "concern for the welfare of the people of Zimbabwe."