Kastoria itself does not appear, however, until the Byzantine–Bulgarian wars of the late 10th/early 11th century (the mention of Diocletianopolis in Constantine Porphyrogennetos' "De Thematibus" is anachronistic, drawing from the 6th-century "Synecdemus"). The town was in Bulgarian hands until 1018, when it was conquered by Basil II.