The French army then crossed the Ticino into Austrian territory and captured the village of Boffalora sopra Ticino after a small battle. Finally, on 5 June, the main Austrian and French armies met at the Battle of Magenta. The Austrians under Gyulay were defeated, leading to his recall to Vienna. Emperor Franz Josef took personal command of the Austrian army in Lombardy-Venetia, and would go on to lose the subsequent Battle of Solferino. In one of his last military engagements he was reduced to a Regimentskommandeur and was sent to defend Mantua from the Piedmontese invasion. Unsuccessful in doing so he surrendered the city in 1866 eventually leading to its annexation to the newly formed Italy.