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
Portugal in the Middle Ages privileges and favours given to the Roman Catholic Church were compensated. In the papal bull " Manifestis Probatum", Pope Alexander III acknowledged Afonso as King and Portugal as an independent land with the right to conquer lands from the Moors. With this papal blessing, Portugal was at last secured as a country and safe from any Leonese attempts at annexation. In 1184, in spite of his great age, King Afonso of Portugal still had sufficient energy to relieve his son Sancho, who was besieged in Santarém by the Moors. He died shortly after, on December 6, 1185. Afonso had already