The value of trade routes through Genoa to the Near East declined during the Age of Discovery, when Portuguese explorers discovered routes to Asia around the Cape of Good Hope. The international crises of the seventeenth century, which ended for Genoa with the 1684 bombardment by Louis XIV's fleet, restored French influence over the republic. Consequently, the Ligurian territory was crossed by the Piedmontese and Austrian armies when these two states came into conflict with France. Austria occupied Genoa in 1746, but the Habsburg troops were driven away by a popular insurrection. Napoleon's first Italian campaign marked the end of the oligarchic Genoese state, which was transformed into the Ligurian Republic, modelled on the French Republic. After the union of Oneglia and Loano (1801), Liguria was annexed to the French Empire (1805) and divided by Napoleon into three departments: Montenotte (department), with capital Savona, Gênes, with capital Genoa and the department of the Apennines, with the capital Chiavari.