Egypt's Hosni Mubarak, accused of corruption and involvement in killing protesters, went on trial on Wednesday, delighting those who overthrew him and ringing an alarm bell for other autocrats around the Arab world.
In a scene that Egyptians would have found unthinkable just eight months ago, the man who ruled them for 30 years was wheeled behind the bars of a courtroom cage in a hospital bed to hear charges that could carry the death penalty.
Mubarak is the first Arab leader to stand trial in person since popular uprisings swept the Middle East this year.
His two sons, Alaa and Gamal, were also in the defendants' cage, clutching copies of the Koran, alongside former Interior Minister Habib al-Adli and six senior security officials.
"I entirely deny all those accusations," said the 83-year-old former president after the prosecutor accused him of intending to kill peaceful protesters during an 18-day revolt that toppled him on February 11 and during the previous decade.
The prosecutor also charged Mubarak with corruption and wasting public funds, and said he had authorised Adli to use live ammunition to quell demonstrations.
About 850 people were killed during the unrest. A lawyer acting for families of the dead demanded execution for Adli.
A military council led by a long-serving defence minister, Field Marshal Mohamed Hussein Tantawi, took over when Mubarak quit. It has promised a transition to democracy in the Arab world's most populous nation -- a process far from complete.
Defence lawyers asked for Tantawi, ex-intelligence chief Omar Suleiman and about 1,600 others to testify as witnesses, in a move that could embarrass Egypt's new military rulers.
The military had tried to distance itself from Mubarak, without being able to silence critics who accused it of seeking to shield its former commander by delaying his trial.
Many Egyptians still revere the army but some protesters say it must also be reformed, faulting its handling of the transition and its vast economic interests in Egypt.
"Mubarak's lawyer wants to embroil Tantawi and generals in council who have said several times in the media that they were given orders to fire at protesters to disband protests," military analyst Safwat al-Zayaat said.
One army officer said Mubarak's trial proved the military's good intentions. "This step unites the army and the people in building a better system, free of corruption," he said.
Protesters had camped out in Cairo's Tahrir Square for three weeks in July seeking a swifter trial for Mubarak and demanding that the military speed up democratic reforms.
After the session, Judge Ahmed Refaat said Mubarak would be moved to a Cairo hospital, instead of the hospital in the Red Sea resort of Sharm el-Sheikh where he has been since April.
He said Mubarak would have to attend the next court session, set for August 15 and that the court would reconvene on August 4 in Adli's case.
The trial, televised around the world, transfixed Egyptians and other Arabs, most of whom have spent their lives under authoritarian systems shaken by this year's "Arab Spring".
"I'm so happy. I feel tomorrow will be better and that the next president knows what could happen to him if he goes against his people," Ahmed Amer, 30, a water utility employee, said outside the Cairo courtroom, where crowds watched the trial on a giant screen erected outside.
Ahmed Farghali, 24, among protesters who had gathered outside the Sharm el-Sheikh hospital before Mubarak was flown to Cairo, said he could not believe he would see the president locked in a cage. "It was beyond my wildest dreams," he said.
Pro-democracy activists across the Arab world took heart at the sight of Mubarak in the dock.
"The trial no doubt inspires Syrians...to see those implicated in the bloodletting of Syrians and theft of the wealth of Syria put behind bars," said Imadeddin al-Rashid, an Islamic law professor who fled Syria.
In Yemen, protesters were glued to small television sets they had brought into the tents where they camped out in Sanaa.
"The trial is a historic event for all Arabs, and Arab leaders will see it means that the age of escaping punishment has ended," said protester Abdullah Zeid.
But in Saudi Arabia, a U.S. ally that tolerates no dissent, a government adviser dismissed the trial as a masquerade, saying: "This is a humiliating spectacle for everyone."
Tunisian President Zine al-Abidine Ben Ali, the first Arab leader to be ousted this year, was tried and sentenced to jail in absentia. He fled to Saudi Arabia.
Earlier Iraq's Saddam Hussein was toppled by U.S.-led forces, then tried and hanged in 2006.
Pro- and anti-Mubarak protesters faced off in Cairo, some hurling stones. Hundreds of police tried to calm them down. The state news agency said 53 people had been wounded.
At a small pro-Mubarak rally, people chanted: "Oh Mubarak, hold your head high". Counter-chants of "Raise your voice, freedom will not die," rose from a nearby anti-Mubarak group.
For some of his opponents, Mubarak's appearance smacked of political theatre to gain sympathy.
"Why is he on a stretcher? Is he handicapped? This is a playing on people's emotions so we can all start crying over an old man," Mohamed Naguib, 32, said in Sharm el-Sheikh, where some chanted: "The people want the execution of the killer."
Police used live ammunition, rubber bullets and teargas on protesters in Cairo and other cities. When the army finally stepped in and Mubarak was flown off to internal exile in Sharm el-Sheikh, Egyptians erupted into euphoric celebrations.
Egyptians blame Mubarak for economic policies they say filled the pockets of the rich while many of the nation's 80 million people scrabbled in squalor to feed their families. They are also angry at his repression of any opposition.
Yet some are reluctant to see a man who was a bomber pilot and then leader of the air force in the 1973 war with Israel put in the dock. Others are simply tired of the disruption protests have caused and want to return to their daily lives.