By this time the Kingdom of Piedmont-Sardinia under Victor Emmanuel II had joined the fight for Italian unification and his naval forces began to shell the city. The siege of Gaeta was the defining moment in the life and short reign of Queen Maria Sophie. She was constantly on the walls, caring for the wounded, encouraging the troops, shouting defiance at the enemy and sharing her food with the hungry soldiers. It was, however, a hopeless fight and the King and Queen were forced to give up Gaeta and go to Rome where they established a government-in-exile which was recognized by most of Europe. They were honored guests of the Papal court but the position of the Pope was under the same threat that had already befallen their own country.
The marriage of Francis II and Marie Sophie was not always without problems but things did improve somewhat following the birth of their daughter in 1869 though the child only lived a few months. When Italian nationalist troops conquered Rome in 1870, ending the era of Papal rule, the King and Queen went to Bavaria where Francis II died in 1894. However, Queen Maria Sophie continued to preside over a Two-Sicilies court-in-exile and never gave up hope for a restoration of her adopted kingdom. During World War I (not surprisingly for a Bavarian princess) the Queen sided with Germany and Austria and hoped that the defeat of Italy might to lead to the restoration of the Kingdom of the Two Sicilies. However, that was not to be but it is remarkable that the Queen generated so much respect and admiration, even from those who would be her most extreme political enemies such as the famous Italian ultra-nationalist Gabriele d'Annunzio who called her the "stern little Bavarian eagle". The Queen died still in exile in Munich in 1925 but her remains were later moved to Naples where she rests with her short-lived daughter in the Church of Santa Chiara.