Maximilian was born in Vienna, Austria on 31 July 1527, the son of Emperor Ferdinand I of Germany and Queen Anne of Bohemia and Hungary; he belonged to his father's House of Habsburg. Maximilian was raised in Innsbruck, Tyrol, and he served under his uncle Charles V of Germany during the Italian Wars in 1544 and during the Schmalkaldic War. In 1548, he married his cousin Maria of Austria, Holy Roman Empress, and he served as the emperor's representative in Spain. In 1562, he became King of Bohemia, and he was elected Holy Roman Emperor two years later when his father died. During his reign, he failed to overcome the Catholic-Protestant divide (having failed to convince King Philip II of Spain to moderate his anti-Protestant policies in the Habsburg Netherlands), and he also fought against the Ottoman Empire as it attempted to expand into Europe; the Imperial fleet defeated the Ottomans at the 1571 Battle of Lepanto. He died in 1576, and he was succeeded by Rudolf II of Germany.