Louis, whose health was quickly deteriorating, invited the representatives of the Polish prelates and lord for a meeting in Zólyom. Upon his demand, the Poles swore loyalty to his daughter, Mary, and her fiancé, Sigismund of Luxemburg, on 25 July 1382. Louis died in Nagyszombat in the night on 10 or 11 September 1382.
Louis I was succeeded in 1382 by his daughter, Mary. However, most noblemen opposed the idea of being ruled by a female monarch. Taking advantage of the situation, a male member of the dynasty, Charles III of Naples claimed the throne for himself. He arrived in the kingdom in September 1385. It was not difficult for him to take power, as he gained the support of several Croatian lords and many contacts he made during his tenure as Duke of Croatia and Dalmatia. The Diet forced the queen to abdicate and elected Charles of Naples king. However, Elizabeth of Bosnia, widow of Louis and mother of Mary, arranged to have Charles assassinated on 7 February 1386. Paul Horvat, Bishop of Zagreb initiated a new rebellion and declared his infant son, Ladislaus of Naples king. They captured the queen in July 1386, but her supporters proposed the crown to her husband, Sigismund of Luxemburg. Queen Mary was soon liberated, but she never again intervened in the government.