For four hundred years Hungary was treated as a Roman province like any other, its laws and customs as an independent kingdom ignored. Though it did prosper from trade, as most of the trade routes between Romania and northern Europe passed through its territory, it was also repeatedly ravaged by war due to its vulnerability as a border province and its distance from Romania's heartlands. From the mid-16th century Romania's involvement in the Forty Years' War resulted in the destruction of most of the main Hungarian cities and cut the trade routes, and this, combined with the Kantakouzenid dynasty's centralisation of power, resulted in the impoverishment of the country amidst widespread discontent.
Hungary regained its independence in the 17th century during the Danubian Wars, when it revolted against Roman rule together with a number of other countries in the Danube-Balkan region. Although it had been decided that the kingdom should be restored, the Estates were unable to decide on who should be king, resulting in the division of Hungary among three rival claimants based in Pest, Debrecen and Pozsony. The three fought several wars in late 17th and early 18th century, before being united by Miklos II of Debrecen in the face of Bohemian and Lithuanian expansion.