A mob threw rocks and fired birdshot at several hundred Christians marching in a protest against Egypt’s Islamist government after the funeral of four Christians killed in sectarian clashes during the weekend.

The Christians were chanting slogans against Islamist President Mohammed Morsi, just as several thousand did earlier during the funeral service nearby in St. Mark Coptic Orthodox Cathedral in Cairo.

The attacking mob, described by witnesses as area residents, forced marchers to take shelter inside the huge cathedral complex. Attackers also showered the protesters with rocks from the roofs of nearby buildings, according to witness Ibrahim el-Shareef.

At least 21 people were injured.

Riot police fired tear gas to quell the rioting. Several tear gas canisters landed inside the cathedral’s grounds, causing a panic among women and children who attended the funeral.

Video footage aired live on the private ONTV network showed young men on the roof of a building adjacent to the cathedral firing handguns toward the compound.

The four Christians, along with a Muslim, were killed in clashes Saturday in a town north of Cairo.

In a separate development Sunday, Egypt’s highest judicial body urged the nation’s top prosecutor to step down less than five months after the president appointed him, reflecting persistent turmoil in the government’s upper echelon that has often been accompanied by violence.

The surprise statement from the Supreme Judiciary Council came on a day when Egypt’s railway services came to a halt because of a strike by train drivers and conductors. The strike snarled inter-city transit.

Carried by the official ­MENA news agency, the statement urged chief prosecutor Talaat Abdullah ‘‘to express a wish’’ to return to his previous job as a judge for the sake of the unity of the judiciary.

Abdullah’s appointment in December set off protests by judges and prosecutors, who called it illegal. It was followed by days of protests at his office in downtown Cairo. The protests forced him to tender his resignation, but then he withdrew it and stayed in office.