During the storms of 1836, water lapped against the city gates of Leiden and Amsterdam. This led to the signing of the Haarlemmermeer Drainage Act by King William 1 on 22 March 1839. After that, a committee was set up whose members included the engineer, M.G. Beijerinck. Work started on 5 May 1840 behind the Treslong farmstead near Hillegom. This signalled the start of the excavation of the 60 kilometre-long Ringdijk and Ringvaart.
King William II decided that Haarlemmermeer should be drained using steam power provided by a Cornish Engine from the county of Cornwall in England. Three steam pumping stations were purchased, each of which generated 360 horse power. They were known as the Leeghwater, the Cruquius and the Lijnden. The Leeghwater was put into operation in June 1848. From April 1849 onwards, assistance was provided by the Lijnden and the Cruquius steam pumping stations. After three years of pumping, the lake had at last been drained by 1 July 1852.
In 1853, a decision was taken to establish two villages. These two new villages were originally named Kruisdorp and Venneperdorp. They were later renamed Hoofddorp and Nieuw-Vennep. Haarlemmermeer became an independent municipality on 11 July 1855. It was only sometime after the Second World War that this poorly accessible area became one of the most important municipalities in the Netherlands.