Egypt's new president backed down Saturday from his decision to remove the country's top prosecutor, keeping him in his post and sidestepping a potential clash with the country's powerful judiciary.

The two-day standoff between President Mohammed Morsi and Prosecutor General Abdel-Meguid Mahmoud escalated with a backlash from a powerful group of judges who said Morsi's move had infringed upon their authority.

The standoff, which both sides later described as a "misunderstanding," exposed the enduring strength of an establishment packed with holdovers from the days of former President Hosni Mubarak, and underlined Morsi's limitations in challenging long-standing institutions.

Some of those who had urged the dismissal of Mahmoud, in the post since Mubarak times, said Morsi's move was clumsily handled and appeared as political score-settling between Islamists and former regime officials rather than the sweeping reform so many are calling for in Egypt.

Though Morsi's decision had considerable public support, it appeared similar to his move to restore the Islamist-dominated parliament to session despite a decree by the Supreme Constitutional Court, which dissolved it over election law violations. He backed down after an uproar over ignoring court rulings.

Morsi had ordered Mahmoud to step down Thursday in an apparent bid to appease public anger over the acquittals of former regime officials a day earlier accused of orchestrating violence against protesters last year.

Egyptian law protects the prosecutor general from being fired by the president. To overcome the constraints, Morsi asked Mahmoud to become ambassador to the Vatican.

But Mahmoud refused to be re-appointed and quickly defied Morsi's decision. Backed by a powerful club of judges which said the move was an infringement on the judiciary, he went to his office on Saturday in defiance, accompanied by a tight security escort and hundreds of supporters.

Hours later, Mahmoud and members of the country's Supreme Judicial Council met with Morsi's advisers.

"I remain in my post. We resolved the problem amicably," Mahmoud told The Associated Press after the meeting. "We told him I wanted to stay and that there was a misunderstanding. He didn't object."

Morsi's Vice President, Mahmoud Mekki, said initially the president wanted to protect the prosecutor general from public pressure and protests, and then cancelled the transfer to avoid "sedition."

"Some politicians are trying to push the judiciary into the political battlefield," Mekki said. "We were surprised by those voices raised to defend the independence of the judiciary. Now those accused of infringing on the judiciary's independence are the ones who had long defended it."

He said the decision was initially made to avoid popular anger following the Wednesday acquittal of Mubarak loyalists over their alleged role in a turning point of the 2011 uprising, known as the "Battle of the Camel," when camels ridden by Mubarak supporters charged into an opposition crowd.

After the meeting with Morsi, hundreds of judges came out to congratulate Mahmoud at his office.

The head of the powerful Judges Club, Ahmed el-Zind, who had rallied behind Mahmoud, said a "face saving" statement will be issued from both sides.

"What we care about is that we assert that the judiciary is a red line which we will not allow anyone to cross," he told attorneys and judges.

The move to remove the prosecutor general presented Morsi with a dilemma: if he moved too aggressively against Mahmoud, it would have fed into criticisms that he is exceeding the powers of his office. If he had moved too slowly, it would have fueled accusations that he is failing to address the goals of the 2011 uprising that overthrew Mubarak.

Many say an entire overhaul of the judiciary, not just removal of the prosecutor general, is needed to effect change in justice and to gain widespread support.

Ahmed Ragheb, a human rights lawyer who had long backed the decision to sack Mahmoud, said Morsi's move backfired and "looked like a fight between the Brotherhood and the prosecutor general."

Ragheb criticized Morsi for not taking action on a package of proposals to overhaul the judiciary that would address issues of justice and retribution for the families of those killed in last year's uprising, and included replacing the prosecutor general.

"It was badly managed," Ragheb said. "Mahmoud has now been given an undeserved status as a hero of judicial independence."

Many Egyptian activists accuse Mahmoud of having failed, either intentionally or due to incompetence, to present a strong case against those accused of abuses during the revolution.

Meanwhile, Morsi is facing unprecedented public discontent.

The judicial standoff was the backdrop to rival rallies Friday in Cairo's central Tahrir square that escalated into street fighting between Morsi's supporters and his critics, the first such confrontation since he came to office in late June.

Pro-Morsi protesters, rallying to urge the removal of Mahmoud, clashed with a planned anti-Morsi demonstration denouncing the lack of progress on economic issues and a hotly contested constitution stuck in a drafting process.

Morsi's supporters say the constitutional drafting panel was set up by an elected parliament and broadly represents Egypt's political factions. Critics say the process is dominated by a majority made up of Islamists, such as the Muslim Brotherhood from which Morsi hails and more radical groups, when it should be determined by consensus.

Liberals and secularists also fear that Morsi's foray into the affairs of the judiciary show he is amassing too much power, especially as he retains legislative authority in the absence of a parliament, which was dissolved just before his electoral victory.

Over 100 protesters were injured in the clashes, while police were nowhere in sight. Morsi's spokesman Yasser Ali said Saturday that the presidency was "displeased" with the violence, adding that "dialogue" should remain the basis for resolving disagreements.

Islamist expert Ammar Ali Hassan said Morsi's decision to back down from a showdown with the judiciary may have been partly influenced by the clashes, which he calls a sign of growing public displeasure.

"He didn't have other options but to back down. The alternative would have been an open conflict with the judiciary, a round I imagine he can't go through, particularly with the visible discontent from the various political groups with the emerging new authority," Hassan said.