During the colonial era the Platine basin was largely neglected by the Spanish Empire until the 1760s, when Portugal and Britain threatened to expand into the estuary. The Spanish colonies in the region were separated from the Viceroyalty of Perú and formed into a new Viceroyalty of the Río de la Plata in 1776. During the Napoleonic Wars Spain became an ally of the French, and Britain invaded the region in 1806–1807 unsuccessfully.