CAIRO (AP) — Egypt’s military issued a ‘‘last-chance’’ ultimatum Monday to President Mohammed Morsi, giving him 48 hours to meet the demands of millions of protesters in the streets seeking the ouster of the Islamist leader or the generals will intervene and impose their own plan for the country.
The military’s statement, read on state TV, put enormous pressure on Morsi to step down and sent giant crowds opposing the president in Cairo and other cities into delirious celebrations of singing, dancing and fireworks. But the ultimatum raised worries on both sides the military could outright take over, as it did after the 2011 ouster of autocrat Hosni Mubarak.
It also raised the risk of a backlash from Morsi’s Islamist backers, including his powerful Muslim Brotherhood and hard-liners, some of whom once belonged to armed militant groups. Already they vowed to resist what they depicted as a threat of a coup against a legitimately elected president.
Pro-Morsi marches numbering in the several thousands began after nightfall in a string of cities around the country, sparking clashes in some places. An alliance of the Brotherhood and Islamists read a statement at a televised conference calling on people to rally to prevent ‘‘any attempt to overturn’’ Morsi’s election.
‘‘Any coup of any kind against legitimacy will only pass over our dead bodies,’’ one leading Brotherhood figure, Mohammed el-Beltagi, told a rally by thousands of Islamists outside a mosque near the Ittihadiya presidential palace.
A line of around 1,500 men with shields, helmets and sticks — assigned with protecting the rally — stamped their feet in military-like lines, singing, ‘‘Stomp our feet, raise a fire. Islam’s march is coming.’’
After midnight, Morsi’s office issued a statement saying a ‘‘modern democratic state’’ was one of the main achievements of the anti-Mubarak revolution, adding, ‘‘With all its force, Egypt will not allow itself to be taken backward.’’ It said Morsi was still reviewing the military’s statement, but added some parts of it ‘‘could cause disturbances in the complicated national scene.’’
U.S. President Barack Obama said the U.S. is committed to democracy in Egypt, not any particular leader. Traveling in Tanzania, Obama said that although Morsi was democratically elected, the government must respect its opposition and minority groups.
Egypt’s Presidency said in a statement that Morsi received a phone call from Obama. According to the statement, Obama said the US administration ‘‘supports peaceful democratic transition in Egypt.’’
Army troops at checkpoints on roads leading to the pro-Morsi rally searched cars for weapons after reports that some Islamists were arming themselves.
In the second day straight day of anti-Morsi protests nationwide, men and women danced outside the Ittihadiya palace, some cried with joy and bands on a stage played revolutionary songs after the military’s statement.
But the army’s stance also raises an unsettling prospect for many of them as well. Many expressed worries of an army takeover. During the time the generals were in power, many of those now in the anti-Morsi campaign led demonstrations against military rule, angered by its management of the transition and heavy hand in the killing of protesters.
‘‘Morsi will leave, but I'm concerned with the plan afterward. The military should be a tool to pressure, but we had a bitter experience with military ruling the country, and we don’t want to repeat it,’’ said Roshdy Khairy, a 24-year-old doctor among the throngs in Tahrir Square.
Hours after its announcement, the military issued a second statement on its Facebook page denying it intended a coup. ‘‘The ideology and culture of the Egyptian armed forces does not allow for the policy of a military coup,’’ it said.
In its initial statement, the military said it would ‘‘announce a road map for the future and measures to implement it’’ if Morsi and its opponents cannot reach a consensus within 48 hours — a virtual impossibility. It promised to include all ‘‘patriotic and sincere’’ factions in the process.
The military underlined it will ‘‘not be a party in politics or rule.’’ But it said it has a responsibility to find a solution because Egypt’s national security is facing a ‘‘grave danger,’’ according to the statement.
It did not detail the road map, but it heavily praised the massive protests that began Sunday demanding that Morsi step down and that early elections be called — suggesting that call had to be satisfied. It said the protests were ‘‘glorious,’’ adding that the participants expressed their opinion ‘‘in peaceful and civilized manner.’’ It urged ‘‘the people’s demands to be met.’’
Morsi met with military chief Abdel-Fattah el-Sissi and Prime Minister Hesham Kandil, according to the president’s Facebook page, without giving details. Associated Press calls to presidential spokesmen were not answered.
In a sign of Morsi’s growing isolation, five Cabinet ministers said they have resigned, the state news agency said. The five are the ministers of communications, legal affairs, environment, tourism and water utilities, MENA reported. The foreign minister also submitted his resignation, government officials said, speaking on condition of anonymity because they were not authorized to talk to the press.
The governor of the strategic province of Ismailia on the Suez Canal, Hassan el-Rifaai, also quit.
The swiftness of the military’s new statement suggested it was prompted by the stunning turnout by the opposition on Sunday — and the eruptions of violence that point to how the confrontation could spiral into chaos if it continues.
Sunday’s protests on the first anniversary of Morsi’s inauguration were the largest seen in the country in the 2½ years of turmoil since Egyptians first rose up against Mubarak in January 2011. Millions packed Tahrir Square, the streets outside the Ittihadiya presidential palace and main squares in cities around the country.
Violence broke out in several parts of the country, often when marchers came under gunfire, apparently from Islamists. In Cairo, anti-Morsi youth attacked the main headquarters of the Muslim Brotherhood with stones and fire bombs, while Brotherhood supporters barricaded inside opened fired on them. The clash ended early Monday when the protesters broke into the luxury villa and ransacked it, setting fires.
Nationwide, at least 16 people were killed Sunday and more than 780 injured, Health Ministry spokesman Yehya Moussa told state television.
The crowds returned Monday across the country — in slightly smaller numbers, but in a more joyous mood after the military’s announcement gave them hope of a quick victory. The group organizing the protests, Tamarod, Arabic for ‘‘Rebel,’’ issued an ultimatum of its own, giving Morsi until Tuesday afternoon to step down or it would escalate the rallies.
‘‘Come out, el-Sissi. The people want to topple the regime,’’ protesters in the Nile Delta city of Mahalla el-Kubra chanted, drumming out a rhythm with a stick on the carcass of a sheep. ‘‘Sheep’’ is the slur many in the opposition use against Brotherhood members, depicting them as mindless followers — to the fury of the Brothers, many of whom are professionals from doctors to university professors.
The broad boulevards packed with anti-Morsi protesters outside the presidential palace transformed into a party.
‘‘In every street in my country the sound of freedom is calling,’’ blared a song that originally emerged during the Arab Spring. Bands on a stage played other revolutionary songs.
‘‘God willing we will be victorious over the president and his failing regime,’’ said Mohammed el-Tawansi, sitting on the pavement with his wife singing along.
‘‘He divided us, now the people and the army are together. They will not be able to do anything. They can’t fight the people and the army,’’ he said, referring to the Muslim Brotherhood.
Down the street, protester Amr el-Ayat raised a banner reading ‘‘cautious optimism.’’
‘‘The military statement was good, because we have no other way now,’’ he said. ‘‘But I worry people will deify el-Sissi. The military is to protect, not to rule.’’
Some were perfectly happy to have the military take over. In Tahrir, Omar Moawad el-Sayed, a math teacher with the beard of a Muslim conservative, said he wished el-Sissi had outright announced military rule.
‘‘The military is the most impartial institution now,’’ he said.
Some hoped that the military’s road map would be a framework drawn up by Tamarod. Under it, after Morsi steps down, the head of the Supreme Constitutional Court would become an interim president and a technocrat government would be formed. An expert panel would write a new constitution to replace the one largely drafted by Islamists, and a new presidential election would be held in six months.
For Islamists, however, the idea of Morsi stepping down was an inconceivable infringement on the repeated elections they won since Mubarak’s fall, giving them not only a longtime Muslim Brotherhood leader as president but majorities in parliament.
Morsi and Brotherhood officials say they are defending democratic legitimacy and some have depicted the protests as led by Mubarak loyalists trying to return to power. But many of his Islamist allies have also depicted it as a fight against Islam.
‘‘The military has sacrificed legitimacy. There will be a civil war,’’ said Manal Shouib, a 47-year-old physiotherapist at the pro-Morsi rally outside the Rabia al-Adawiya Mosque not far from Ittihadiya.
Ahmed Abdel-Aziz, who was the ‘‘trainer’’ of the line of men doing military-style drills, shouted and roared in a tirade against Mubarak loyalists, Christians, judges, police, opposition politicians, columnists and writers he said were conspiring against Morsi. He said they attacked ‘‘anywhere that has Islam in it.’’
‘‘El-Sissi’s statement doesn’t concern us. We will sacrifice ourselves to defend legitimacy and we will die if this is our destiny,’’ he told the AP. ‘‘If the whole of Egypt is wiped out so that God’s word can remain, so be it.’’
At sunset, the cleric at Rabia al-Adawiya led prayers, asking God to ‘‘accept us as martyrs for your cause and make your slave Mohammed Morsi victorious.’’
Nearly 1,500 supporters of the president marched in the Canal city of Suez after night prayers, chanting for Morsi and damaging cars. Some carried sticks and rifles that fire birdshot, witnesses said. Residents confronted them, taking their weapons and firing in the air to disperse them, while the army deployed and fired tear gas.
Outside the palace, protesters contended that Morsi could not survive with only the Islamist bloc on his side.
‘‘It is now the whole people versus one group. What can he do?’’ said Mina Adel, a Christian accountant. ‘‘The army is the savior and the guarantor for the revolution to succeed.’’
Associated Press writers Tony G. Gabriel and Mariam Rizk contributed to this report.