CAIRO — 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.