CAIRO -- Prosecutors opened an investigation of ousted President Mohammed Morsi on charges including murder and conspiracy with the Palestinian militant group Hamas, fueling tensions amid a showdown in the streets, as tens of thousands of backers of the military and supporters of Morsi held rival mass rallies Friday across Egypt.

The announcement, which is likely to pave the way to a formal indictment, was the first word on Morsi's legal status since the military deposed him on July 3. For more than three weeks, the Islamist leader has been held by the military in a secret location, incommunicado.

The accusations are connected to a prison break during the 2011 uprising against autocrat Hosni Mubarak in which gunmen attacked a prison northwest of Cairo, freeing prisoners including Morsi and around 30 other figures from his Muslim Brotherhood. The prosecutors allege Morsi and the Brotherhood worked with Hamas to carry out the break, in which 14 guards were killed.

The Brotherhood has denied the charges, calling them politically motivated. On Friday, a spokesman for Morsi's Muslim Brotherhood said the move to prosecute Morsi showed "the complete bankruptcy of the leaders of the bloody coup."

Egyptians "reject the return of the dictatorial police state and all the repression, tyranny and theft it entails," Ahmed Aref said in a statement.

The announcement came as massive crowds poured into main squares in Cairo and other cities in support of the military after the army chief Gen. Abdel-Fattah el-Sissi called for rallies. El-Sissi said days earlier he hoped for a giant public turnout to give him a mandate to stop "violence and terrorism," raising speculation he may be planning a crackdown on pro-Morsi protests.

At the same time, crowds of Islamist backers of Morsi massed at their own rallies, part of what the Brotherhood and its allies had previously said would be their biggest protests to date to demand the reinstatement of the president. El-Sissi's call days earlier may have been in part aimed to overwhelm the Islamist numbers in Friday's rallies, as each side tries to show the depth of its public support.

The rival shows of strength only deepen the country's divisions since Morsi's fall -- and dramatically hike fears of violence. By mid-afternoon Friday, clashes and fistfights broke out between military supporters and Morsi backers in the Mediterranean coastal cities of Alexandria and Damietta and in a Cairo neighborhood, leaving at least 18 injured, according to Health Ministry spokesman Khaled el-Khateeb.

El-Sissi deposed Morsi after four days of giant protests by millions of Egyptians demanding the removal of the country's first freely elected president. Since then, Islamists have been holding sit-ins and rallies daily.

State media and pro-military private TV stations have been fiercely promoting the el-Sissi rallies, pumping up a nationalist fervor.

El-Sissi's portrait pervaded the crowds of tens of thousands in Cairo's central Tahrir Square: the smiling general in sunglasses on posters proclaiming "the love of the people," a combination photo of the general and a lion on lanyards hanging from people's necks, a picture of his face photoshopped into a 1-pound note of currency.

"The people, the source of all power, mandate the army and police to purge terrorism," read a giant banner stretched across one entrance to Tahrir. Three tanks guarded another street leading into the square, and helicopters swooped overhead.

Security was heavy after el-Sissi vowed to protect the rallies from attacks by rivals. Tanks guarded one entrance to Tahrir and police were stationed at other parts. "The people give their mandate," read signs touted by many in the crowd.

"The army are here to protect the people, they don't lie," said Ezzat Fahmi, a 38-year-old in the crowd. He said el-Sissi had to call Friday's rallies "so the entire world can see that the Egyptian people don't want the Brotherhood anymore."

It remains unclear what steps the military is planning after Friday's show of public strength. The most explosive step would be if it were to try to break up sit-ins by Islamists who have been camped out at locations in Cairo and other cities for weeks.

The military also could move to arrest more than a dozen Brotherhood figures who have arrest warrants against them. Or it could take firmer action to stop any sign of violence by Islamist protesters -- though the Morsi camp says it is the one targeted by attacks.

Clashes have repeatedly erupted the past three weeks pitting Morsi supporters against his opponents or security forces. Each side blames the other for sparking violence, and people in both camps have been seen carrying weapons.

At the same time, Islamic militants have stepped up attacks on the army and police in the Sinai Peninsula. Nearly 200 people have been killed since Morsi's fall.

The prosecutors' announcement on Morsi could signal a greater move to go after the Brotherhood in courts. Besides Morsi, five other senior figures from the group have been detained.

The MENA news agency said Morsi has now been formally detained for 15 days pending the completion of the investigation into the accusations. It did not say, however, whether he would now be moved now to a regular detention facility where he could receive family visits. His detention can be extended as the inquiry continues. The news agency indicated that Morsi has already been interrogated.

MENA said Morsi was being investigated over allegations of collaborating with Hamas "to carry out anti-state acts, attacking police stations and army officers and storming prisons, setting fire to one prison and enabling inmates to flee, including himself, as well as premeditated killing of officers, soldiers and prisoners."

The case is rooted in the mass jailbreak of more than 30 Muslim Brotherhood leaders, including Morsi, from a prison northwest of Cairo during the 2011 popular uprising that toppled Morsi's predecessor, autocrat Hosni Mubarak.

Over recent months, a court in the Suez Canal city of Ismailia has heard testimonies from prison officials and intelligence officers indicating that Morsi and his Brotherhood colleagues were freed when gunmen led by Hamas operatives stormed the Wadi el-Natroun prison. At least 14 members of the security forces were killed and the jail's documents and archives destroyed.

Muslim Brotherhood officials have said they got out when local residents broke into the prison to free their relatives and that they had no knowledge ahead of time of the prison break.

Hamas has consistently denied any involvement. On Friday a spokesman for the militant group, Sami Abu Zuhri, condemned Morsi's detention order.

"The Egyptian decision is an attempt to drag Hamas into the Egyptian conflict," he said. "We call on the Arab League to bear its responsibility in confronting the incitement against Hamas."

Morsi's only account of his jailbreak came in a frantic phone call he made to Al-Jazeera Mubasher TV moments after being freed. "From the noises we heard ... It seemed to us there were (prisoners) attempting to get out of their cells and break out into the prison yard, and the prison authorities were trying to regain control and fired tear gas," Morsi said in the call.

By the time they got out, the prison was empty, and there was no sign of a major battle, he said.

Senior Brotherhood official Essam el-Erian rejected the detention order, saying Morsi continues to enjoy immunity as the nation's "legitimate" president, and he can stand trial only as part of a constitutional process that allows that.

The detention order, he wrote on his official Facebook page, "lays bare the fascist nature of military rule ... our response will be with millions in peaceful rallies in the squares."

------

Associated Press writers Tony G. Gabriel and Sarah El Deeb in Cairo and Mohammed Daraghmeh in Gaza City, Gaza Strip contributed to this report.