CAIRO When Muslim Brotherhood leader Mohamed Mursi broke out of an Egyptian jail during Hosni Mubarak's final days in office in 2011, he little thought he would end up behind bars again.
Less than three years later, the deposed president's trial for inciting violence, which starts on Monday, could land him in prison for the rest of his life, or worse.
After decades of repression under Egyptian autocrats, the Muslim Brotherhood won every election since a popular uprising toppled Mubarak in 2011, eventually propelling Mursi to power.
The U.S.-trained engineer's victory in the country's first free presidential election broke a tradition of domination by men from the armed forces, which had provided every Egyptian leader since the overthrow of the monarchy in 1952.
The euphoria that greeted the end of an era of presidents who ruled like pharaohs did not last long.
Mursi promised a moderate Islamist agenda to steer Egypt into a new democratic era where autocracy would be replaced by transparent government that respected human rights and revived the fortunes of a powerful Arab state long in decline.
The stocky, bespectacled Mursi told Egyptians he would deliver an "Egyptian renaissance with an Islamic foundation".
Instead, he alienated millions who accused him of usurping powers, imposing the Brotherhood's conservative brand of Islam and mismanaging the economy, all of which he denied.
The son of a peasant farmer was something of an accidental president, thrown into the race at the last moment by the disqualification on a technicality of millionaire businessman Khairat al-Shater, by far the group's preferred choice.
Mursi is a civil engineer and lecturer with a doctorate from the University of Southern California. He has spoken of a simple childhood in a village in the Nile Delta province of Sharqia, recalling how his mother taught him prayer and the Koran.
In power, Mursi made the cardinal mistake in Egyptian politics; he alienated the military. The army chief that Mursi appointed because he was known as a religious man, General Abdel Fattah al-Sisi, eventually turned on him.
Detecting mass discontent in the streets, Sisi pushed Mursi to reach compromises with his political opponents. He refused, and reached out mainly to the Brotherhood and other Islamists.
A youth movement called Tamarud - "rebellion" in Arabic - began a petition calling for Mursi to step down. Eventually millions took to the streets demanding that he go.
Sisi, who was Mubarak's military intelligence chief, appeared on television on July 3 to announce the end of Mursi's troubled one-year presidency and plans for elections.
Mursi had cited fear of judgment day as one reason for seeking the top office. He said: "We are worried that God will ask us, on the Day of Reckoning: 'What did you do when you saw that the nation was in need of sacrifice and effort?"
A severe security crackdown has since left Mursi's Brotherhood in disarray. Riot police backed by army snipers crushed Cairo protest camps calling for his reinstatement, killing hundreds.
Top Brotherhood leaders have been rounded up, including the group's supreme guide. Some fear the army-backed government will bring back the iron-fisted rule of the Mubarak years, but most Egyptians back Sisi.
Mursi, who has been held in an undisclosed location since his arrest four months ago, now faces a day of reckoning in court at the same police academy where Mubarak is on trial.
(Editing by Will Waterman)