Egypt's president, Mohamed Morsi, vowed to protect his presidency with his life on Tuesday night, hours before an ultimatum from the leader of Egypt's armed forces is due to expire.

In a defiant late-night speech, Morsi raised the stakes in the standoff between the Muslim Brotherhood and the Egyptian military – the two most powerful groups in the land – as supporters and opponents of the president clashed in deadly gun fights across the country.

It leaves Egypt braced for its most decisive day since the revolution, with its military preparing to suspend the country's constitution and potentially cripple the authority of its first democratically elected leader.

The Supreme Council of the Armed Forces (Scaf) made clear that it would stick to an ultimatum it gave Morsi on Monday that urged the embattled president to respond to a wave of mass protests within 48 hours or face an intervention which would in effect subsume his government. Scaf has given no indication it will waive its ultimatum, which expires at 5pm on Wednesday.

But Morsi's midnight speech made it clear he felt he derived his authority from electoral legitimacy that could not be overridden. Warning against both domestic and international intervention, he claimed that any attempt to force him from power would spark violent conflict between Islamists and their opponents.

"If the price for legitimacy is my blood, then I am prepared to sacrifice my blood to legitimacy and my homeland," Morsi said in a speech that seemed aimed more at rallying his supporters than addressing his opponents, and which mentioned legitimacy more than 30 times.

Earlier in the evening, the military command again claimed that its widely anticipated actions would not amount to a military coup.

However, according to details of a roadmap for ending the crisis obtained by Reuters, the military commander Abdul Fatah al-Sisi would play a central role in the country's affairs, installing an interim council of civilians and delaying parliamentary elections until a new constitution was drafted. A senior military source said that scenario was the most likely among those being discussed.

Morsi, a leading figure in the Muslim Brotherhood movement, took office after elections in June last year. His tenure as leader – the first to replace the ousted dictator Hosni Mubarak – has been plagued by claims that governance under him has been strongly tilted towards his Islamist power base at the expense of other key stakeholders in Egyptian society.

Egypt's moribund economy has also taken centre stage since the weekend, which marked the first anniversary of Morsi taking office, with his government being blamed for chronic fuel shortages and high food prices.

Supporters of Morsi have denied claims that the government is unrepresentative and said Egypt would not be "driven backwards" by the military's threat to intervene.

At rallies held by pro-Morsi supporters in parts of Cairo, including Nasr City, and in the north of the country Muslim Brotherhood leaders vowed an all-out battle to defend the status quo. There were reports that some men carried burial shrouds at the Nasr City rally to demonstrate the extent of their defiance.

"Any coup of any sort will only pass over our dead bodies," the senior Brotherhood official Mohamed el-Beltagy said in a speech at a rally on Monday night, calling for "families in all Egyptian governorates and villages to be prepared to take to the streets and fill squares" to support the president.

However, the rallies were dwarfed in size and fervour by a demonstration at the focal point of Egypt's revolution, Tahrir Square, which demanded that Morsi quit or form a power-sharing government that would sharply diminish the influence of his support base.

Those calling for the end of his presidency include an uneasy alliance of disaffected backers, as well as supporters of the former regime – many of whom were on opposite sides of a violent divide in the heady months after Mubarak fell.

The breadth of opposition to Morsi appears to give him and the Muslim Brotherhood few options in the coming days and sets the scene for either an ignominious defeat or a new phase of violent uncertainty.

Even the interior ministry, a staunch supporter of the Mubarak regime, appears to have abandoned him. Morsi has repeatedly offered to speak with his opponents, but has been rebuffed at every turn by groups who increasingly feel they have little to gain by accepting a dialogue as his problems pile up.

Several more key aides and cabinet ministers quit the Morsi government on Tuesday as the president met Sisi in the presidential palace. With the two men locked in a long discussion, military helicopters again circled Tahrir Square. The army released video footage taken from the helicopters that showed festive scenes below, in an act that clearly demonstrated the armed forces remained behind the protesters.

By nightfall, hours before Sisi's expected announcement, Tahrir Square was once more overwhelmed by demonstrators, who had spilled across a bridge over the Nile. There were reports of sporadic armed clashes in Cairo early in the evening, with gunfire heard in Giza. However, the centres of both camps remained largely peaceful.

Long regarded as a trusted and integral part of Egyptian life, the military has never been far from events during the past two and a half years. It distanced itself from Mubarak as his authority crumbled, then was accused of overplaying its hand during the transitional phase that led to last year's elections. Over the last few days, however, it has been widely embraced by an eclectic array of Morsi opponents.

"I voted for Morsi, but I changed my mind because he didn't live up to what he promised," said Ahmed Mahmoud, 25, in Tahrir Square. "If it wasn't for the recent army statement, we'd all be in a state of war."

Shaima Salah, 28, said the military's role in any post-Morsi period should be short and limited. "The only solution is for the army to lead a very short transitional period, until new presidential elections," she said. "But I'm worried about the army taking over the state, and Egypt going back to a military kind of government."