In 1244 Heerlen came under the authority of the dukes of Brabant, but in 1388, along with Hoensbroek, it was given a separate status. During the Eighty Years' War (1568–1648), Heerlen was disputed by the kingdom of Spain and the Dutch Protestant rebels and swapped sides several times. At the 1661 Partage Treaty, Heerlen became part of "Staat-Limburg", ruled by the States-General of the newly founded Dutch Republic. Being in the border region, close to the Spanish territories, it remained quite isolated until 1793, when the French conquered Heerlen. After the defeat of Napoleon in 1814, it became part of the Netherlands province of Limburg (present-day Dutch and Belgian Limburg). In 1830, like most of Limburg, Heerlen sided with Belgium in the Belgian Revolution. In 1839 however, as a result of an agreement between the main European powers (the London Conference), it became part of the Netherlands again.