in 1678 one of the most influential young nobleman of upper hungary and transylvania, imre thököly declared war against the habsburgs. in august 1678 thököly's army occupied almost all lower and upper hungary. habsburg rule in royal hungary quickly collapsed. the fugitives joined the thököly uprising, and officially elected him their leader in szoboszló in january 1680. the kuruc troops were merged into thököly's own army.