WRAPUP 5-Egyptian court orders Mubarak's release
* Mubarak could be freed on Thursday
* Muted reaction to release of toppled strongman
* Mubarak still faces retrial for complicity in killings
(Adds reaction, details)
CAIRO, Aug 21 (Reuters) - Deposed Egyptian leader Hosni Mubarak will leave jail as early as Thursday after a court ruling that jolted a divided nation already in turmoil seven weeks after the army toppled Islamist President Mohamed Mursi.
Convening on Wednesday at the Cairo jail where Mubarak is held, the court ordered the release of the military man who ruled Egypt for 30 years until he was overthrown during the uprisings that swept the Arab world in early 2011.
Asked when his client would go free, Mubarak's lawyer, Fareed al-Deeb, told Reuters: "Maybe tomorrow".
Mubarak, 85, was sentenced to life in prison last year for failing to prevent the killing of demonstrators. But a court accepted his appeal earlier this year and ordered a retrial.
The ailing ex-president probably has no political future, but the court ruling, which state prosecutor Ahmed el-Bahrawi said cannot be appealed, made some Egyptians indignant.
"The army has brought back Mubarak's regime, the same regime," said Guma Abdel Alim, outside a bicycle shop in central Cairo. "Those who were elected by the people are now in prison."
He was referring to a widescale security sweep on Mursi's Muslim Brotherhood that has netted many of its leaders.
Shopworker Rubi Abdel Azim said Mubarak had been the worst ruler in Egypt's history, but a passerby in a worn-out shirt disagreed. "He was the greatest president," said Nagi Hassan.
Political turbulence has kept Egypt on edge for months. At least 900 people, including 100 soldiers and police, have been killed in a crackdown on Mursi supporters in the past week, making it the country's bloodiest internal episode in decades.
The United States and the European Union are both reviewing aid to Cairo in light of the bloodshed, but Saudi Arabia, a foe of the Brotherhood, has promised to make up any shortfall.
There was no immediate reaction to the ruling on Mubarak from the Brotherhood, whose leaders are mostly behind bars.
Mubarak is still being retried on charges of complicity in the killing of protesters during the revolt against him, but he has already served the maximum pre-trial detention in that case.
The court ruling removed the last legal ground for his imprisonment in connection with a corruption case, following a similar decision in another corruption case on Monday. Mubarak will not be allowed to leave Egypt and his assets remain frozen.
Mubarak's two sons, Gamal and Alaa, along with former Interior Minister Habib el-Adly, are still in prison, and Adly's lawyer said the ruling on Mubarak had no bearing on their cases.
Some of the liberal and secular politicians who backed the army's ousting of Mursi, Egypt's first freely elected president, on July 3, said they regretted the hated Mubarak's release, but argued that the judiciary's decision should be respected.
"His regime was lousy and he destroyed the country," said Mohamed Abolghar, head of the Egyptian Social Democratic Party, to which the army-appointed interim prime minister belongs.
Noting Mubarak's age and the jail time he has served, he said: "We should focus on building the country, establishing democracy and finishing the problem of the Muslim Brotherhood.
"The government knows that if Mubarak is freed there will be public outrage, but a court decision is a court decision."
Khaled Dawoud, spokesman of the liberal Dostour Party, said the trials of the ex-president and his associates had all been flawed because the judiciary was ill-equipped to deal with cases related to Mubarak's rule, resulting in a series of acquittals. "It was a faulty process from the beginning," he said.
The relatively muted response from Mubarak's non-Islamist opponents may reflect a reluctance to rock the boat following the army's removal of Mursi, which they had endorsed.
The generals say they were responding to the will of the people after vast demonstrations organised by liberals and leftists demanding Mursi's ouster. They have installed an interim administration to oversee a roadmap back to democracy.
The authorities now portray their quarrel with the Brotherhood, Egypt's best-organised political force, as a fight against terrorism and are jailing its leaders, detaining the group's "general guide", Mohamed Badie, in Cairo on Tuesday.
Saudi Arabia and the United Arab Emirates, which along with Kuwait have promised Egypt $12 billion in aid since Mursi's ouster, have frowned on Mubarak's detention all along. Arab diplomats said the conservative Gulf monarchies had lobbied for the release of a man they once valued as a strong regional ally.
Mubarak's trial, when he appeared in a courtroom cage, and his jailing also affronted some Egyptian officers. One colonel, who asked not to be named, said the treatment of the former supreme military commander had "tarnished the army's image".
Lobna Moneib, spokeswoman of the leftist Popular Current movement, said the court ruling posed a problem. "We think he is guilty and have called for him to be tried by revolutionary courts," she said, advocating such trials for all Mubarak-era officials as well as for Mursi and his Brotherhood colleagues.
The United States, a close ally of Egypt since Cairo signed a peace treaty with Israel in 1979, said on Tuesday that the crackdown on protesters could influence U.S. aid. It denied reports it had already suspended assistance.
At issue is the future of about $1.23 billion in U.S. military assistance and $241 million in economic aid to Egypt.
The European Union was expected on Wednesday to shy away from making immediate cuts in financial aid to Egypt, but several EU governments pushed for the withdrawal of military support.
Meeting in Brussels, EU foreign ministers debated how to use their economic muscle to force the government to end its crackdown and consider a peaceful compromise.
Western nations were uneasy during Mursi's year in power, when he rammed through an Islamist-tinged constitution.
Washington has not denounced the army takeover as a "coup", which under U.S. law would force a suspension of aid. The ensuing bloodshed, however, has dismayed the West.
U.S. Senator John McCain, a former Republican presidential nominee, said on Wednesday: "The slaughter of hundreds of Egyptians in the street is appalling to all of us."
He said U.S. aid should be conditioned on a change in the constitution and scheduling of elections as soon as possible. "The present government is representative of no one," he said.
The arrest of Badie, the Brotherhood's leader, is part of a wave of detentions among the upper echelons of the organisation.
Murad Ali, a media adviser to the Brotherhood's political party, and Safwat Hegazy, a fiery preacher, were arrested while trying to flee the country, state media reported on Wednesday.
The Brotherhood said the crackdown would prove futile.
"The putschists think that arresting the leaders of the Muslim Brotherhood and marring their image in the media will make Egyptians bow and give in to the coup," it said.
"They have killed thousands, wounded thousands, arrested thousands but the (people) are continuing in their peaceful revolution, rejecting the coup and military rule."
(Additional reporting by Cairo bureau, Justyna Pawlak and John O'Donnell in Brussels, Lesley Wroughton and Patricia Zengerle in Washington, and Elaine Lies in Tokyo; Writing by Alistair Lyon; Editing by Michael Georgy and Will Waterman)