This defensive structure dating from the Islamic period was built between the 8th and 9th centuries. Perched atop the Santa Bárbara Hill, it was used to control merchant traffic along the Guadiana and mining operations. Having been abandoned during the 11th century, the old Alcoutim castle was never again used for military purposes. Following the (Re)conquest of the Algarve, the new Christian powers preferred the current town of Alcoutim, where they built a castle and started a new settlement.