The Principality of Moldavia was a Polish fief since the Middle Ages and Sigismund aimed at securing that despite the growing threat from the south. With the Ottoman influence on the rise, the Sultan aimed at expanding the Ottoman Empire westward. The Ottoman–Habsburg wars, which lasted almost two centuries, were also a sign of the Sultan's desire to rule mainland Europe. Voivode Gaspar Graziani, ruler of Moldavia, decided to switch sides in favour of Poland and rebelled against the Turks. In turn, Sigismund sent an army to aid Graziani, a move which sparked the Polish–Ottoman War.