Hostalric is first mentioned in documents dating from 1106 under the names Ostalrico and Quota. However, it is not known whether the town was already surrounded by walls at that time. In the following century, King James I the Conqueror granted Viscount Guerau V de Cabrera permission to hold a market in the town, and Hostalric was granted its town charter between 1242 and 1243. The defensive structure that can still be seen today therefore most likely originated between the 13th and 14th centuries. Six hundred metres of fortified walls and eight towers survive, including the Cabrera Tower. Other preserved structures include the Hortes Gate—the only gateway in the walls to remain in its original state—the reconstructed Barcelona Gate and, outside the walls, the Frares Tower and the Convent Tower.