Although Dortmund had the status of an important independent town in previous times (it was the only free Imperial city in Westfalen), this appears also to have been its undoing. At the end of the Thirty Years War (1618-1648), it could only get rid of foreign troops by payments of large sums of money. Dortmund became a more and more minor town (it had 4397 inhabitants in 1809) until industrialization reversed the trend. Apart from the usual coal and iron industries, it benefitted from the arrival of the Dortmund-Ems Canal, to which was connected the Rhein-Herne Canal. Dortmund was a major center for brewing beer.