During the Albigensian Crusade it surrendered of its own accord to Simon de Montfort, and thus entered into the kingdom of France in 1229. In 1317, Pope John XXII established the bishopric of Castres. In 1356, the town of Castres was raised to a countship by King John II of France. However, the town greatly suffered from the Black Plague in 1347-1348, then from the Black Prince of England and the Free Companies (bands of lawless mercenaries) who laid waste the country during the Hundred Years' War. Consequently, by the late 14th century Castres entered a period of sharp decline. In 1375, there were only 4,000 inhabitants left in town, only half the figure from a century before. Following the confiscation of the possessions of Jacques d'Armagnac, duke of Nemours, to which the countship of Castres had passed, it was bestowed in 1476 by King Louis XI on Boffille de Juge (Boffillo del Giudice), an Italian nobleman and adventurer serving as a diplomat for Louis XI, but the appointment led to so much disagreement (family feud between Boffille de Juge, his only daughter, and his brother-in-law) that the countship was united to the crown by King Francis I in 1519.