War of the Second Coalition
Under Charles IV, government was controlled by Chief Minister Manuel Godoy, as the King spent most of his time hunting. Driven by Godoy, Spain agreed an alliance with France in the August 1796 Second Treaty of San Ildefonso and declared war on Britain, then engaged in the 1798-1802 War of the Second Coalition.