CAIRO (AP) - Supporters and opponents of Egypt's Islamist president battled in the streets near Tahrir Square on Friday as an Islamist rally demanding a purge of the judiciary devolved into violence.

The rally centered on a contentious aspect of the country's deep political polarization - the courts. Islamist backers of President Mohammed Morsi say the judiciary is infused with former regime loyalists who are blocking his policies, while opponents fear Islamists want to take over the courts and get rid of secular-minded judges to consolidate the Muslim Brotherhood's power.

But beyond the specific issues, the scenes of youths from both sides waving homemade pistols and beating each other with sticks illustrated how entrenched violence has become in Egypt's political crisis. In recent weeks, several marches and rallies by the country's various camps have devolved into street battles, fueling the bitterness on all sides.

Thousands of Morsi supporters - mostly backers of the Muslim Brotherhood and Islamist hard-liners - held rallies Friday outside the High Court building in Cairo and in the coastal city of Alexandria, demanding the "cleansing of the judiciary."

The marches appeared aimed at presenting Islamists' actions on the courts as a popular "demand of the revolution." Islamist lawmakers who dominate the legislature have announced plans to begin debating a bill regulating the judiciary, presenting it as aimed at ensuring the independence of courts they contend are dominated by supporters of ousted leader Hosni Mubarak.

But opponents believe the Islamists aim to remove judges and install new ones who support their agenda. In an interview with a Kuwaiti newspaper this month, the former head of the Brotherhood, Mehdi Akef, called the judiciary "sick" and "corrupt" and said a new law could force out 3,500 of Egypt's approximately 13,000 judges and prosecution officials by lowering the retirement age to 60 from 70 - though it remains to be seen if lowering the age will be in the final bill.

As some Islamists moved toward Cairo's Tahrir Square, they were met by anti-Morsi youth a few blocks from the square, some of them in black masks. It was not clear who started the clashes, but it led to both sides pelting each other with stones and firing gunshots. One bus was seen set on fire. The sound of birdshot cracked through the air in the clashes, and tear gas was fired - even though there were no police nearby.

Some of the masked youths and Islamists were seen with homemade pistols. Others wielded iron bars and tree branches and broke up street pavements to throw the chunks of asphalt and concrete. More than 80 people were injured, according to the state news agency MENA.

Amid the battles, Islamists were seen dragging rivals to the ground and beating them. In one case, they beat a protester then shoved him into an ambulance, forced the ambulance workers out and drove off in the vehicle.

Ahmed Hamdi, a Muslim Brotherhood supporter at the scene, blamed the anti-Morsi protesters for the violence, calling them "thugs" and saying they set the bus on fire.

"The whole story is they see that Islamists are now in power. They can't swallow this, that Islamists rule them. It's a battle with the old regime," he said.

As the clashes raged, Abu Ismail spoke to supporters at a mosque, telling them, "The death of 100 or 1,000 or 10,000 is nothing if in return the Islamic nation lives."

Egypt has been deeply divided for months over Morsi's rule and the political dominance of his Islamist allies, leading to repeated violence even as the country's economy continues to deteriorate.

Morsi's opponents accuse the Islamists of hijacking the revolution, not living up to his earlier election campaign promises to have inclusive political process and of monopolizing power and allowing human rights abuses. The president, the Brotherhood and Islamist politicians say the opposition is using street violence to topple elected Islamists and destabilize the country.

The judiciary has become a significant battleground - the sole branch of government not dominated by Morsi's Islamist allies, although he does have some backers among the judges.

Many judges accuse Morsi of trying to undermine their authority, while the president's allies charge that Mubarak supporters in the courts are blocking Morsi and derail Egypt's transition to democracy.

The Brotherhood, from which Morsi hails, says reforming the judiciary is a completion of the revolution. The group criticized the courts this week over several recent acquittals of former Mubarak officials and over a court order to release Mubarak himself during his re-trial on charges of killing protesters during the 2011 uprising that led to his ouster. Mubarak remains in custody over other charges and is unlikely to be released.

During Friday's rallies, Mohammed el-Beltagi, a leading Brotherhood member, told supporters that the judiciary is backing "the counter-revolution" and that Egypt is in need of "revolutionary decisions," referring the new judicial law.

The head of the Brotherhood's political party, Saad el-Katatni, told a political gathering Thursday that it is time to "complete work on the institutions." He insisted that "the people who carried out the revolution don't allow any authority, even the judiciary, to transgress on popular will."

On Friday, el-Katatni dismissed accusations that the group aims to monopolize power as "a blatant lie."

Leftist, secular and revolutionary groups have long called for reforming the judiciary, the Interior Ministry and other institutions to fight corruption and remove Mubarak holdovers. But they fear the Islamists will only to install their own supporters.

The leftist opposition Popular Current Party said that the Islamists' call for rallies were "a right used to serve a wrong."

"This is the beginning of a massacre of the Egyptian judiciary," it said in a statement. "It is clear that the Muslim Brotherhood aims at executing a new scenario to monopolize the judiciary."

Not all Islamist parties joined Friday's rally, with several ultraconservative Salafi groups staying away. The leader of the Salafi Nour Party, Younis Makhyoun, blamed the Brotherhood for Friday's violence, saying the call for the rally only "fuels volatility, division and chaos."

The judiciary has dealt the Islamist camp several setbacks. Courts dissolved the Islamist-majority lower house of parliament last year, saying the law governing its election was invalid. This year, a court forced a delay in elections for a new parliament when it ruled that a new election law had to be reviewed by the Supreme Constitutional Court.

The election had been due to start this month but they have been put off with no new date set. In the meantime, the upper house of parliament - the Shura Council, a normally powerless body elected by no more than 6 percent of voters and where Islamists hold an overwhelming majority - is serving as the legislature.

The courts and Morsi have had frequent frictions since his inauguration in June.

In November, Morsi infuriated many in the judiciary by issuing decrees that made his decisions immune from judicial challenge for a time, protected a constitutional assembly from being dissolved by the courts and unilaterally installed a new prosecutor.

The prosecutor remains in place despite a court order last month annulling his appointment.

"We all call for reforming the judiciary, not controlling it," said Nasser Amin, the head of the Arab Center for the Independence of the Judiciary. The aim of getting rid of so many judges at once would be "to control the whole system and use it against opponents."