Matthias Corvinus signed a five-year truce with Bayezid II in October 1483. The truce applied to all Moldavia, with the exception of the ports. Bayezid invaded Moldavia and captured Chilia on 14 or 15 July 1484. His vassal, Meñli I Giray, also broke into Moldavia and seized Cetatea Albă on 3 August. The capture of the two ports secured the Ottomans' control of the Black Sea. Bayezid left Moldavia only after Stephen personally came to pay homage to him. Although this prostration was largely without effect on Moldavian independence, the loss of Chilia and Cetatea Albă put an end to the Moldavian control of important trading routes. Corvinus was unwilling to break his own truce with Bayezid, having tacit Ottoman backing for his own war in the west. However, he granted his vassal a territorial gift in Transylvania, comprising the domains of Ciceu and Cetatea de Baltă. According to various interpretations, this exchange occurred in or after 1484, and was meant to compensate Stephen for the loss of his ports. Medievalist Marius Diaconescu dates the lease of Cetatea to 1482, when Corvinus agreed to give Stephen a place of refuge, should Moldavia fall to the Ottomans, while Ciceu only became Stephen's castle in 1489. Both citadels were on land confiscated after conflicts between the Three Nations and Corvinus. Ciceu had been a fief of the Losonczi family, under litigation, while Cetatea had been a special domain of the Voivode of Transylvania, whose last titular owner before Stephen was John Pongrác of Dengeleg. By then, war between the Poles and the Ottomans was in preparation, with clashes between the two sides occurring in 1484. Scholar Șerban Papacostea notes that Casimir IV had always remained neutral during Stephen's conflicts with the Ottomans, but the Ottoman control of the mouths of the Dnieper and the Danube threatened Poland. The king, Papacostea argues, also wanted to strengthen his suzerainty over Moldavia, which helped him decide to intervene in the conflict on Stephen's behalf. Casimir formed or joined with an anti-Ottoman league, which, in 1485, had also gathered reluctant support from the Teutonic Knights.