 In the days of the Muslim kingdoms, in the location of the present town, there was an Arab castle, around which a mosque was built, and around them grew the town.The name Mestanza, of Berber origin, Mistasa, means mosque.The town was conquered by Christian king Alfonso VI in 1086.