After the Second Italian War of Independence and the defeat in the Battle of Solferino in 1859, Austria by the Treaty of Zurich had to cede Lombardy up to the Mincio River, except for the fortresses of Mantua and Peschiera, to the French Emperor Napoleon III, who immediately passed it to the Kingdom of Sardinia and the embryonic Italian state. Maximilian retired to Miramare Castle near Trieste, while the capital was relocated to Venice. However, remaining Venetia and Mantua likewise fell to the Kingdom of Italy in the aftermath of the Third Italian War of Independence, by the 1866 Peace of Prague. The territory of Venetia and Mantua was formally transferred from Austria to France, and then handed over to Italy on 19 October 1866, for diplomatic reasons; a plebiscite marked the Italian annexation on 21–22 October 1866.