Between 1703 and 1711, there was a large-scale uprising led by Francis II Rákóczi, who after the dethronement of the Habsburgs in 1707 at the Diet of Ónod, took power provisionally as the Ruling Prince of Hungary for the wartime period, but refused the Hungarian Crown and the title "King". The uprisings lasted for years. The Hungarian Kuruc army, although taking over most of the country, lost the main battle at Trencsén (1708). Three years later, because of the growing desertion, defeatism and low morale, the Kuruc forces finally surrendered.