in mountains. During the 19th century, the population began to grow around the palace, but this remained generally a rural community (an aspect that would continue until the 20th century). José Mangens in 1936 echoed similar indications of Mafra in writing about old Rua dos Arcipestres, noting: "...Mafra offers nothing interesting and looks more like a hinterland village with its huts and ruined portals typical backyard, shielded with old cans...". As Guilherme José Ferreira de Assunção later wrote, after a few visits, Queen Maria realized the advantages of establishing a military contingent in the Convent of Mafra, which she initiated. This change transformed the region and its people, who lived in a precarious conditions of existence. After 1840, the Convent was occupied by the army. By 1859, 4000 troops would enlist in the official military boot-camp (), established by King Pedro V. Unfortunately, the institution was abolished in the following year, when 94 recruits died from an infectious disease. But, from 1848–1859 and 1870–1873, the convent continued to house the Royal Military College (). In 1887 the Infantry and Cavalry School () and, a year later, in Tapada, a firing range was established, that was later frequented by King Carlos, an enthusiast of shooting. During the French invasion of Portugal in 1807, Napoleon made the Mafra Palace headquarters and garrison. Part of the army headed for Peniche and Torres Vedras under orders from General Luison, the remaining forces garrisoned in the Palace and Convent, while the executive staff requisitioned homes in the village. This lasted nine months, until 2 September 1807, when British forces were able to extricate the French from their positions. Meanwhile, Portuguese engineers, allied to British forces constructed a system of fortresses north of Lisbon, to secure the defence of the capital and expel the French. The Lines of Torres Vedras, as they were known, passed through the municipality of Mafra, and were constructed in 1809 and 1810. Of the 156 fortresses, 48 were located within Mafra municipality, and represented the second line of defence including sites in Malveira, Gradil, Ribamar, Carvoeira, Mafra and Ericeira. In the main only vestiges of these forts and redoubts remain, but those that are still in good condition or have been restored include the forts of Feira, Santa Susana, and Zambujal. Within the Tapada there were forts in Sunível, Milhariça, Juncal and Silvério, while a group of forts followed the left