Transylvania, together with the neighboring counties, gained the status of an autonomous state under Ottoman suzerainty after the central territories of the Kingdom of Hungary had been annexed by the Ottomans in 1541. The fall of the kingdom also deprived Wallachia and Moldavia of their main ally in the struggle against the Ottoman Empire. In 1594, Michael the Brave of Wallachia joined the anti-Ottoman alliance initiated by Pope Clement VIII. After a series of victory over the Ottomans, he turned against Transylvania and Moldavia where pro-Polish and pro-Ottoman princes were reigning. He invaded and occupied Transylvania in 1599, and Moldavia in 1600. Although the personal union of the three countries collapsed four months later, it served as an ideal for later generations working for the unification of the lands that now form Romania.