The announcement prompted scenes of jubilation in Cairo's Tahrir Square, where Mursi's supporters gathered.
Egypt's moderate Islamist force Muslim Brotherhood claimed victory in the presidential poll on Monday and promised to build a modern democratic state, but the landmark election stood overshadowed by uncertainty as the ruling military took over legislative powers.
Some 400 people arrived from the direction of Tahrir Square shouting slogans against remnants of the former regime on Monday night. They broke into the villa in Dokki neighbourhood that houses Shafiq's offices, stole computers and documents and threw some into the street, an eyewitness said.
Egypt's new military rulers buckled under continued public pressure and removed Prime Minister Ahmed Shafiq, handpicked by ousted President Hosni Mubarak, replacing him with a new nominee. Former Transport Minister Essam Sharaf will be the new prime minster, a brief military statement said. The sacking of Shafiq was a key demand of the opposition protest movement.
Ousted Egyptian dictator Hosni Mubarak's two sons and his last Prime Minister Ahmed Shafiq were on Thursday acquitted of corruption charges by a criminal court in Cairo.