 But due to William's subsequent involvement in the great Epirote-Achaean-Sicilian alliance against the Empire of Nicaea, his defeat and capture at the Battle of Pelagonia and his captivity at the hands of the Nicaean emperor Michael VIII Palaiologos (r. 1259–1261), a final peace treaty was delayed until William's release in 1262.The treaty, signed at the residence of the Archbishop of Thebes, essentially restored the "status quo ante"