History of Portugal (1640–1777) put to the test in 1762 when Spain invaded aided by France, during the Seven Years' War. Britain invoked its alliance with Portugal and sent troops. Several months later, the conflict was settled with comparatively little fighting. In 1777, Spain and Portugal signed the Treaty of San Ildefonso, which mainly resolved a number of border disputes between their South American colonies. During the Age of Enlightenment, Portugal was considered one of Europe's unenlightened backwaters; it was a country of three million with 200,000 people in 538 monasteries in 1750. Melo seems to have been deeply embarrassed by Portugal's much lamented
Border Reivers were other factors which promoted a predatory mode of living in the Borders. A system of inheritance called gavelkind meant that estates, and particularly land, were divided equally between all sons on a man's death; although this was considered more fair than primogeniture, it also meant that many people owned insufficient land to survive. Also, much of the border region is mountainous or open moorland, unsuitable for arable farming but good for grazing. Livestock was easily rustled and driven back to raiders' territory by mounted reivers who knew the country well. The raiders also often removed easily portable household goods