The castle was built between 1328 and 1341 by the Byzantine Emperor Andronicus III Palaeologus , as part of the fortification programme implemented immediately after his accession to the throne, to strengthen the defences of the Macedonian capital, Thessaloniki, and its environs, and to control the crossings towards western Macedonia.
http://www.kastra.eu/castleen.php?kastro=gynaikastro
https://www.academia.edu/38855266/An_Essay_on_Byzantine_Fortification._Northern_Greece_4th-15th_c