Despite these setbacks, in the 19th century the economy of Castres developed greatly, and the town grew outside of its old medieval center. As early as 1815, the first mechanized wool mill was set up in town. Originally specialized in luxury cloth, the Castres textile industry then turned toward more ordinary types of cloth, whose markets were considerably larger. Around 1860, there were 50 wool mills in town, employing 3,000 people. In the end of the 19th century, mechanical engineering industries appeared beside the textile industry, which led to Castres becoming a major arsenal for the French army during the First World War. Castres was linked to the French railway network in 1865. At the end of the 19th century, Castres was the largest town in the "" of Tarn, with 5,000 more inhabitants than Albi.