CAIRO (AP) — A court ordered the release of Hosni Mubarak and prosecutors said they're unlikely to appeal, raising the possibility Egypt's deposed autocrat could walk free after more than two years in detention.

Wednesday's decision threatened to stoke tensions in the deeply divided nation, widen the circle of anger against the military-backed government and amplify Islamist allegations that last month's military coup was a step toward restoring the old regime.

Even if Mubarak is released, the 85-year-old former president is still on trial on separate charges that could put him back behind bars. Meanwhile, the prospect of Mubarak freed, even if only temporarily, would feed into the larger crisis bedeviling Egypt: the violent fallout from the July 3 coup that unseated Mohammed Morsi, an Islamist who became Egypt's first freely elected president following Mubarak's ouster.

Mubarak's release "will cause chaos," said human rights lawyer Nasser Amin. "It will be used by Islamists as proof of the return of the old regime ... and can lead to new alliances between revolutionary groups and political Islam."

The youth campaign that spearheaded the petition and protests against Morsi that led to his eventual ouster, Tamarod, blamed his government for Mubarak's possible release because they said it failed to admit new evidence in the case against the autocrat.

In a statement, Tamarod warned against releasing Mubarak, saying it would be a threat to national security. The group appealed to the interim authorities to use the emergency measures in place earlier this month to keep the former president behind bars.

The group said revolutionary groups "will not stand idle seeing the killers of martyrs get acquitted."

"If it is acquittal for Mubarak today, it will be acquittal for Morsi tomorrow," the group said, vowing to hold a public show trial for Mubarak soon. "We will not remain silent about freedom for any killer of the Egyptian people."

Story continues

The three judges convened in Tora prison, where Mubarak has been held for most of his detention since April 2011, and their decision was transmitted to official Egyptian media. But even before they ruled, human rights advocates were arguing for a new system of justice to make up for shoddy prosecution and a judiciary divided between loyalists of the old regime, Islamists and independents.

Egypt's prosecutor Hesham Barakat told local media that the Wednesday decision was final and his office has no plans to appeal it. A senior prison official, Mostafa Baz, told the private CBC television station that his office will ask the prosecutors on Thursday whether Mubarak is wanted in other cases. If he's not, Baz said the former leader would be freed.

The possibility of Mubarak's release came in the midst of the post-coup crackdown that has left more than 1,000 people dead and hundreds in detention.

The pro-Islamist camp was waning as its leadership and Morsi himself were arrested. Other serious blows this week were three high-level arrests: of the supreme leader and spiritual guide of Morsi's Muslim Brotherhood, of a cleric instrumental in fomenting street protest against the coup, of a senior Brotherhood spokesman, and of a senior group official who served as a governor in south Egypt during Morsi's rule. Despite the crackdown, the pro-Morsi groups vowed to hold massive rallies on Friday.

On the streets of Cairo, interviews about Mubarak highlighted the deep polarization in Egypt, which doesn't always clearly fall into pro-Morsi or pro-military camps.

"This is an absurd charade by the judiciary, the army, and the police in order to reinstate Mubarak and his corrupt regime and to rob the people of their revolution," said Ibrahim Mohammed, who said he wasn't a Morsi supporter.

Another Cairo resident, Ahmad Kamal, said it was time Mubarak was set free.

"He should have been released a long time ago. God forgive them for what they have done and the judiciary has ordered this so that should be enough. I have complete faith in the Egyptian judiciary," Kamal said.

Since his overthrow in February 2011, Mubarak has been on a roller coaster ride through the courts during which he has been convicted, only for another court to overturn the ruling, grant him a retrial and order him released. Still, he was kept behind bars pending his retrial and on other charges.

For his first trial, on charges of corruption and conspiracy in the deadly shooting of nearly 900 protesters during the uprising against him, he was on a gurney behind prison cage bars and denied the charges. The first Arab leader to face trial by his own people, he was convicted and sentenced to life in prison.

Last January, he was interrogated about gifts he allegedly received from Al-Ahram, the country's flagship state-owned newspaper, and agreed to refund it $3 million. And in the same month a court overturned his life sentence on the grounds that the prosecution lacked concrete evidence and failed to prove the protesters were killed by the police.

In April, an investigation began into allegations Mubarak and his family embezzled state funds designated for the maintenance and upkeep of presidential palaces. And on April 13, he was back on trial for alleged complicity in the killing of protesters in the last days of his rule. That trial, the one that could put him back in prison, resumes on Aug. 25.

Since his detention, Mubarak repeatedly has been hospitalized. As president, his health was a state secret. Since his ouster, Mubarak's supporters have released conflicting details, including that he suffered a stroke, a heart attack and at times went into a coma. His critics called these an attempt to gain public sympathy and court leniency.

Lawyer Ahmed Ragheb, who was part of a commission appointed by Morsi to find new evidence for the trial of Mubarak and associates, said the decision to release Mubarak was no surprise. He said the prosecution was poor and the evidence was collected by police who were largely loyal to Mubarak and his security chiefs.

"This goes to show that the main problem (of prosecuting Mubarak) is in the judiciary ... and the failure to institute a transitional justice process," he said. "The judiciary, including the prosecution, the police and the courts, go back to the Mubarak era."