town's history was in 1139, when nobles declared Afonso Henriques to be Portugal's first king. The town's Gothic cathedral was built by him, although only the Romanesque tower is left from the original building, with its carved Renaissance portal and fine cloister dating from the 16th and 18th centuries. The 12th-century castle preserves a fine keep and a very old and unusual cistern with monograms of master masons. King Sancho I issued a charter of independence in 1191, as the local community grew around two poles: the ecclesiastical parishes of Sé and Castelo. In 1290, King Denis provided a market charter to the city, attracting merchants from Castile and Granada with their oriental spices and textiles. Lamego had a privileged positioned on the routes from western Iberia, as a transit point within the settlements of the Além-Douro, Braga and Guimarães, from Alcântara and Mérida to Córdoba and Seville. It was also one of the preferred routes on the Saint James Way pilgrimage to Santiago de Compostela. But, two events changed the economic and social circumstances in the region: the conquest of Granada which drove the last of the Moors from the Peninsula; and the discovery of the maritime connection to India, which resulted in a slow decline for the region. Early modern era Manuel I of Portugal issued a foral (charter) in 1514. Also in the 16th century, Manuel de Noronha (one of the more notable prelates of Lamego) was appointed the Bishop of Lamego, occupying the role for the next 18 years and referred to the "great builder", responsible for the cult of Nossa Senhora dos Remédios (Our Lady of Remedies). In the 17th and 18th century, the solares (country estates) were slowly constructed in Lamego, resulting from the wine commerce down the Douro. The economic growth of viticulture along the Douro resulted in the issuance of a writ by Sebastião José de Carvalho e Melo, 1st Marquis of Pombal, to designate the area as the Região Demarcada do Douro and the establishment of the Companhia Geral da Agricultura das Vinhas do Alto Douro (General Company of the Wine Agriculture of the Upper Douro). In 1835, Lamego was the capital of the district, but lost this title to Viseu (December 1835), under the authority of the King's Minister Luís Mouzinho de Albuquerque. In 1919, in an attempt to restore the monarchy, Lamego became the capital of the district for