CAIRO (AP) -- The army chief came to President Mohammed Morsi with a simple demand: Step down on your own and don't resist a military ultimatum or the demands of the giant crowds in the streets of Egypt.
"Over my dead body!" Morsi replied to Gen. Abdel-Fattah el-Sissi on Monday, two days before the army eventually ousted the Islamist leader after a year in office.
In the end, Egypt's first freely elected president found himself isolated, with allies abandoning him and no one in the army or police willing to support him.
Even his Republican Guards simply stepped away as army commandos came to take him to an undisclosed Defense Ministry facility, according to army, security and Muslim Brotherhood officials who gave The Associated Press an account of Morsi's final hours in office. They spoke on condition of anonymity because they were not authorized to talk to the media.
The Muslim Brotherhood officials said they saw the end coming for Morsi as early as June 23 -- a week before the opposition planned its first big protest. The military gave the president seven days to work out his differences with the opposition.
In recent months, Morsi had been at odds with virtually every institution in the country, including the top Muslim and Christian clerics, the judiciary, the armed forces, the police and intelligence agencies. His political opponents fueled popular anger that Morsi was giving too much power to the Brotherhood and other Islamists, and had failed to tackle Egypt's mounting economic problems.
There was such distrust between Morsi and the security agencies that they began withholding information from him -- deploying troops and armor in cities in the past week without his knowledge, the officials said.
The police also refused to protect Muslim Brotherhood offices that came under attack in the latest wave of protests.
Thus, when Morsi was fighting for his survival, there was no one to turn to, except calling for outside help through Western ambassadors and a small coterie of aides from the Brotherhood who could do little more than help him record two last-minute speeches.
In those remarks, he emotionally emphasized his electoral legitimacy -- a topic that Morsi repeatedly raised in the talks with el-Sissi.
Early this week, during two meetings in as many days, Morsi, el-Sissi and Hesham Kandil, the Islamist-backed prime minister, sat down to discuss ways out of the crisis in which millions of Egyptians were clamoring for the president to resign.
But Morsi kept returning to the mandate he won in the June 2012 balloting, according to one of the officials. He said Morsi wouldn't address the mass protests or any of the country's most pressing problems -- tenuous security, rising prices, unemployment, power cuts and traffic congestion.
A Brotherhood spokesman, Murad Ali, said the military had already decided that Morsi had to go, and el-Sissi would not entertain any of the concessions that the president was prepared to make.
"We were naive. ... We didn't imagine betrayal would go this far," Ali said.
"It was like, 'Either we put you in jail, or you come out and announce you are resigning,'" Ali added. "He didn't do either because he didn't want to hand the country to the military again."
But according to one official, Morsi delivered the final, terse response to el-Sissi's demand: "Over my dead body!"
On Monday, the armed forces announced they had given Morsi 48 hours to meet the protesters' demands or face military intervention.
In reality, however, the countdown had begun as early as June 23, when el-Sissi gave Morsi and the opposition a week to work out their differences -- a remote possibility given the wide gap between both sides.
Brotherhood officials said they saw the end coming based on el-Sissi's comments nine full days before Morsi's actual ouster.
"We knew it was over on June 23. Western ambassadors told us that," said another Brotherhood spokesman. U.S. Ambassador Anne Patterson was one of the envoys, he added.
Morsi searched for allies in the army, ordering two top aides -- Asaad el-Sheikh and Rifaah el-Tahtawy -- to establish contact with potentially sympathetic officers in the 2nd Field Army based in Port Said and Ismailia on the Suez Canal.
The objective was to find army allies to use as a bargaining chip with el-Sissi, security officials with firsthand knowledge of the contacts said.
There were no signs that Morsi's overtures had any effect, but el-Sissi, on learning of the contacts, took no chances. He issued directives to all unit commanders not to engage in any contacts with the presidential palace and, as a precaution, dispatched elite troops to units whose commanders had been contacted by Morsi's aides.