Armies displayed their loyalty to the monarchy in 1848 and 1849, suppressing the revolutionary regimes that had swept into power in Vienna, Budapest, Milan, and Prague. In 1859 Austria was provoked into war with Piedmont and its supporter, the France of Napoleon III. The Austro-Piedmontese War lasted only three months, but both sides mobilized large armies. The Austrians were defeated after bitter fighting at Magenta and Solferino, the young Emperor Franz Joseph assuming personal command during the Battle of Solferino.