Egyptian security forces on Saturday afternoon managed to clear the Al-Fath mosque in Cairo where hundreds of supporters of ousted President Mohamed Morsi barricaded themselves since Friday, the BBC reported.
Many of the protesters who were in the mosque were arrested.
Earlier, pro-Morsi gunmen opened fire on security forces from a second floor window in the Cairo mosque.
Live television showed a gunman firing at soldiers and police from the minaret of the mosque, with security forces shooting back at the building. Reuters witnesses said Morsi supporters also exchanged gunfire with security forces inside the mosque.
Hundreds of anti-government protesters have reportedly left the mosque after security forces fired tear gas into the mosque, Israel Radio reported.
Tensions started to run high when a woman wearing a niqab - the full head to toe black veil - tried to walk out of the mosque, said a Reuters witness.
A group of about 10 soldiers had been telling people to leave the mosque and that they would be in no danger.
When the woman approached them, people in the mosque could be overheard saying she was the wife of a Brotherhood leader and was in danger of being arrested. She walked back into the mosque, looked up and said something to a group of pro-Morsi gunmen armed with AK-47 assault rifles. That is when the shooting started.
It is still unknown how many casualties were resulted from the mosque standoff.
Proposal to disband Muslim Brotherhood
Morsi's Muslim Brotherhood has said it is committed to peaceful resistance to the army-backed government which toppled him. But a Brotherhood spokesman said this week that anger was out of control because of a bloody security crackdown.
The interior ministry said 173 people died in clashes across Egypt on Friday, bringing the death toll from three days of carnage to almost 800.
Among those killed was a son of Muslim Brotherhood leader Mohamed Badie, shot dead during a protest in Cairo's huge Ramses Square where about 95 people died in an afternoon of gunfire and mayhem on Friday.
Egyptian authorities said they had rounded up more than 1,000 Islamists and surrounded Ramses Square following Friday's "Day of Rage" called by the Brotherhood to denounce a lethal crackdown on its followers on Wednesday.
Witnesses said tear gas was fired into the mosque prayer room to try to flush everyone out and gunshots were heard.
With anger rising on all sides, and no sign of a compromise in sight, Prime Minister Hazem el-Beblawi proposed the legal dissolution of the Brotherhood - a move that would force the group underground and could lead to a broad crackdown.
"It is being studied currently," said government spokesman Sherif Shawky.
The Brotherhood was officially dissolved by Egypt's military rulers in 1954, but registered itself as a non-governmental organization in March in a response to a court case brought by opponents of the group who were contesting its legality.
Founded in 1928, the movement also has a legally registered political arm, the Freedom and Justice Party, which was set up in 2011 after the uprising that led to the downfall of veteran autocrat Hosni Mubarak.
"Reconciliation is there for those who hands are not sullied with blood," Shawky added.
The Brotherhood won all five elections that followed the toppling of Mubarak, and Morsi governed the country for a year until he was undermined by mammoth rallies called by critics who denounced his rule as incompetent and partisan.
Army chief Abdel Fattah al-Sisi says he removed Morsi from office on July 3 to protect the country from possible civil war.
The interior ministry said that 1,004 Muslim Brotherhood "elements" had been arrested in the last 24 hours, accusing members of Morsi's movement of committing acts of terrorism.
Amongst those detained on Saturday was Mohamed Al-Zawahiri, the brother of al-Qaida leader Ayman Al-Zawahiri, security sources said.
The ministry also said that since Wednesday, 57 policemen were killed and 563 wounded in the violence.
Almost 600 people died on Wednesday when police cleared out two Brotherhood sit-ins in Cairo. Despite the growing bloodshed, the Islamist group has urged its supporters to take to the streets everyday for the coming week.
"Our rejection of the coup regime has become an Islamic, national and ethical obligation that we can never abandon," said the Brotherhood, which has accused the military of plotting the downfall of Morsi to regain the levers of power.
Many Western allies have denounced the killings, including the United States, but Saudi Arabia threw its weight behind the army-backed government on Friday, accusing its old foe the Muslim Brotherhood of trying to destabilize Egypt.
Worryingly for the army, violence was reported across Egypt on Friday, suggesting it will struggle to impose control on the vast, largely desert state.
The government said 12 churches had been attacked and burned on Friday, blaming the Islamists for the destruction.
JPost.com staff contributed to this report.
Stay on top of the news - get the Jerusalem Post headlines direct to your inbox!