On that day, the town ceased to be a fortification. The attackers are reported to have lost 400 dead, the defenders just six. The invaders forced the townsfolk to breach the walls and blew up the Bellinghoven and Oerath gates, both of which blocked free passage to the Netherlands. In the War of Spanish Succession, Erkelenz was occupied by Prussian troops in 1702 who did not leave again until 1713. In the Treaty of Utrecht in 1714 Duke John William of Jülich and Elector Palatine (of Palatinate-Neuburg) was given Erkelenz; the town not paying him homage until 1719. The town thus lost its centuries-old affiliation with the Upper Quarter of Guelders. From 1727 to 1754 the territory of Erkelenz ("Herrlichkeit Erkelenz") was pledged to Freiherr von Francken, who also stayed from time to time in the town. From 1794 to 1815 it belonged to France, along with the lands left of the Rhine, and was given a permanent contingent of French troops. Initially Erkelenz formed a municipality ("Munizipalität"), from 1800 a "mairie" (mayoralty) and, from 1798, was the seat of the canton of Erkelenz in the "arrondissement" of Crefeld, which was part of the "département" of Roer. In 1815 the King of Prussia became the new landlord following Napoleon's defeat at Waterloo. In the years 1818/19 the tumbledown town walls and gates were demolished. Instead of walls the four present-day promenade streets were built, each named after their respective points of the compass. From 1816 to 1972 Erkelenz was the seat of the rural district of Erkelenz ("Kreis Erkelenz"). Around 1825 Andreas Polke from Ratibor took up residence in the town and founded a pin factory. The nearby region around Aachen was a leading light in this trade at the time. In 1841 Polke employed 73 workers in his factory, of whom 36 were child workers under 14; for those of school age he ran a factory school. Pins were made in Erkelenz until about 1870. In 1852 Erkelenz was connected to the Aachen–Mönchengladbach railway and, in addition to a railway station for passenger services, was also given a goods station with marshalling sidings, a hump and a turntable.