The Battle of Pelagonia or Battle of Kastoria took place in early summer or autumn 1259, between the Empire of Nicaea and an anti-Nicaean alliance comprising Despotate of Epirus, Kingdom of Sicily and the Principality of Achaea. It was a decisive event in the history of the Eastern Mediterranean, ensuring the eventual reconquest of Constantinople and the end of the Latin Empire in 1261. The rising power of Nicaea in the southern Balkans, and the ambitions of its ruler, Michael VIII Palaiologos, to recover Constantinople, led the formation of a coalition between the Epirote Greeks, under Michael II Komnenos Doukas, and the chief Latin rulers of the time, the Prince of Achaea, William of Villehardouin, and Manfred of Sicily. The details of the battle, including its precise date and location, are disputed as the primary sources give contradictory information; modern scholars usually place it either in July or in September, somewhere in the plain of Pelagonia or near Kastoria. It appears that the barely concealed rivalries between the Epirote Greeks and their Latin allies came to the fore in the lead-up to the battle, possibly fanned by Palaiologos' agents. As a result, the Epirotes abandoned the Latins on the eve of the battle, while Michael II's bastard son John Doukas defected to the Nicaean camp. The Latins were then set upon by the Nicaeans and routed, while many nobles, including Villehardouin, were taken captive. The battle cleared the last obstacle to the Nicaean reconquest of Constantinople in 1261 and the re-establishment of the Byzantine Empire under the Palaiologos dynasty. It also led to the brief conquest of Epirus and Thessaly by Nicaean forces, although Michael II and his sons rapidly managed to reverse these gains. In 1262, William of Villehardouin was released in exchange for three fortresses on the southeastern tip of the Morea peninsula. This foothold would be gradually expanded, and would over the next century become the Despotate of the Morea. Background Following the fall of the Byzantine Empire to the Fourth Crusade in 1204, the two main Byzantine Greek contenders for the imperial legacy of Byzantium were the Empire of Nicaea in western Asia Minor, and the Despotate of Epirus in western Greece. This engendered a persistent rivalry between the two states as to which would first recover Constantinople. Nicaea gained an important advantage following the conquest of Macedonia by the Nicaean emperor John III Vatatzes ().