But the Egyptian president decided at the last minute to change the ending.
"Mubarak called an audible," the official said.
The Egyptian president startled many of his aides with an address, unseen by others, in which he appeared determined to cling to office. The speech surprised and angered the White House, enraged Cairo's legions of protesters and pushed the country closer to chaos, current and former U.S. government officials said in interviews recounting the events of the past 48 hours.
In the end, Mubarak's efforts only ensured a hasty and ignominious departure, the officials said. Within hours of the speech, Egyptian army officials confronted the discredited president with an ultimatum: Step down voluntarily, or be forced out.
Mubarak's defiant speech - described by some U.S. officials as bordering on delusional - was a final, wild plot twist in a saga that had played out in Egypt and Washington over the past 18 days. The likelihood of Mubarak's departure alternately rose and dipped as U.S. military officers and diplomats quietly worked with their Egyptian counterparts in a search for peaceful resolution to the country's worst unrest in six decades.
By midweek, confronted with growing throngs in Cairo, labor strikes and deteriorating economic conditions, top military and civilian leaders reached an apparent agreement with Mubarak on some form of power transfer. The details of the plan - and how it unraveled Thursday - were described in interviews with six former and current U.S. government officials who were knowledgeable about the details. Most of the sources insisted on anonymity in order to talk about the administration's internal policy discussions and diplomatic exchanges with Egyptian officials.
Communication between top U.S. and Egyptian officials had become increasingly sporadic early this week as Mubarak deputies complained publicly about U.S. interference in Cairo's affairs. But then U.S. intelligence and military officials began to learn details of the plan by Egyptian military leaders - something between a negotiated exit and a soft coup d'etat - to relieve Mubarak of most, if not all, of his powers.
The plan went into effect Thursday with announcements in Cairo to pro-democracy demonstrators that their key demands were about to be met. A rare meeting was convened of Egypt's Supreme Council of the Armed Forces, and afterward a military spokesman released a communique that seemed to assert the army's control over the government. The statement stressed "the responsibility of the armed forces and its commitment to protect the people and its keenness to protect the nation."
The statement prompted cheers among the hundreds of thousands of demonstrators who had gathered in Cairo's Tahrir Square anticipating an announcement of Mubarak's departure.
Hours later in Washington, CIA Director Leon Panetta made a scheduled appearance before the House Intelligence Committee. Asked about Egypt, he cited reports suggesting a "strong likelihood that Mubarak may step down this evening." The CIA retreated from the assertion, saying the director was referring to news reports, but the agency's classified cables continued to point to a likely transfer of power in Egypt that day, according to two U.S. officials familiar with the intelligence.
President Obama was en route to Marquette, Mich., for an event on wireless technology. Just before 2 p.m. Washington time, he took to the stage at Northern Michigan University to signal his approval for a transfer of power in Egypt that appeared to be only minutes away. "We are witnessing history unfold," an ebullient Obama said.
His words hinting of historic changes underway in Egypt were meant to express optimism without forecasting when Mubarak might surrender his powers, an administration official said. But the speech added to the growing anticipation about a speech by the Egyptian president set to take place two hours later - 11 p.m. in Cairo and 4 p.m. in Washington.
A solemn-looking Mubarak appeared on Egypt's state television just as Obama was returning to the capital. The U.S. president and his aides watched with increasing dismay as Mubarak criticized Western interference and ticked off a list of promises for the coming months. Although he referred vaguely to a decision to transfer "some of the power" to his newly appointed vice president, Omar Suleiman, his tone was defiant and he offered no hint of stepping down.
U.S. officials and Middle East experts who analyzed the speech said it was a case of extraordinary miscalculation on Mubarak's part. "It was a public relations disaster," said Daniel Kurtzer, a former U.S. ambassador to Egypt. The speech provoked roars of outrage from Tahrir Square as thousands of demonstrators began to march on the presidential palace and state TV headquarters, many of them shouting, "Leave, leave."
Mubarak's defiant tone conveyed his refusal to accede to expectations in Washington that he was finally leaving, said Scott Carpenter, a Middle East expert with the Washington Institute for Near East Policy.
"Mubarak went off script," Carpenter said. "But it wasn't what he said so much as it was the way he said it. He essentially agreed to say everything the army wanted him to say, but he couldn't say it the way people expected him to."
After landing in Washington, Obama assembled his national security team in the Oval Office to discuss the response. He sat down afterward to pen a first draft of his public response, choosing language that more clearly than ever put the White House on the side of the demonstrators. The final version began with this sentence: "The Egyptian people have been told that there was a transition of authority, but it is not yet clear that this transition is immediate, meaningful or sufficient."
"It unmistakably aligned us with the aspirations of the people in Tahrir Square," said a senior administration official involved in the Oval Office meeting.
It was a crucial shift for a White House that had been the scene of sometimes heated exchanges between aides who pressed for a strong message of support for democratic change in Egypt and others who worried that doing so could disrupt the traditional government-to-government relationship with a key ally.
There was a discernible change in Cairo, as well. Within hours of Mubarak's speech, "support for Mubarak from [the] military dropped precipitously," said a U.S. government official who closely tracked the events.
"The military had been willing - with the right tone in the speech - to wait and see how it played out," the official said. "They didn't like what they saw."
Even Suleiman, Mubarak's longtime intelligence chief, joined ranks with military leaders late Thursday. "He had been trying to walk a fine line between retaining support for Mubarak while trying to infuse common sense into the equation," the U.S. official said. "By the end of the day, it was clear the situation was no longer tenable."
Mubarak was told Friday that he must step down, and within hours, he was on his way to the Red Sea resort of Sharm el-Sheikh. It was Suleiman who announced the change in leadership. At 6:04 p.m. Cairo time, the vice president stood before a television camera to formally declare the end of three decades of Mubarak rule.
"President Hosni Mubarak has decided to step down from the office of president of the republic and has charged the high council of the armed forces to administer the affairs of the country," Suleiman said. "May God help everybody."
Staff writers Karen DeYoung, Greg Miller, Mary Beth Sheridan and Scott Wilson and staff researcher Julie Tate contributed to this report.