When Frederick III needed the dukes to finance a war against Hungary in 1486, and at the same time had his son (later Maximilian I) elected king, he faced a demand from the united dukes for their participation in an Imperial Court. The Austrian–Hungarian War was a military conflict between the Kingdom of Hungary under Mathias Corvinus and the Habsburg Archduchy of Austria under Frederick V (also Holy Roman Emperor as Frederick III). The war lasted from 1477 to 1488 and resulted in significant gains for Matthias, which humiliated Frederick, but which were reversed upon Matthias' sudden death in 1490.