In 1285, Charles became monarch but remained in an Aragonese prison. She did not take part in the regency for him in Naples, but remained in Provence, where she did take part in the administration from time to time, though she was not formal regent. In 1288, she took part in the negotiations of her consort's release, and the same year, she made a peace treaty with Aragon. Charles was released the same year, and they returned to Naples together. In 1290-94, she was regent for him in Provence.
Struggle for the Hungarian throne On 10 July 1290, Mary's brother, King
Ladislaus IV of Hungary was murdered by three Cuman assassins,. Since Ladislaus had died childless, the question now was who would succeed him: in addition to Mary, her sisters Catherine and Elisabeth believed that they had claims, as did the children of the youngest sister, Anna. In addition, the crown was already claimed by Ladislaus' cousin
Andrew the Venetian, who was the next heir according to
agnatic descent. Andrew was summoned from Vienna by Archbishop Lodomer, who crowned him King Andrew III on 23 July with the
Holy Crown of Hungary in
Székesfehérvár, the traditional site for Hungarian coronations. However, Mary refused to accept Andrew's right to the crown, because in her view his father
Stephen the Posthumous had been a bastard, and thus not a legitimate member of the
House of Árpád (the royal family of Hungary). Stephen had been born to the third wife of King
Andrew II after her husband's death, and was not recognised by his elder half-brothers, including Mary's grandfather
Béla IV. In April 1291, Mary declared her own claim to the throne. The
Babonići,
Frankopans,
Šubići, and other leading Croatian and Slavonian noble families seemingly accepted her as the lawful monarch, although as events showed their loyalty in fact vacillated between her and Andrew III. In January 1292, she transferred her claim to Hungary to her son, the 18-year-old
Charles Martel Charles was then set up by
Pope Nicholas IV and the church party as the titular
King of Hungary (1290–1295) as the successor of Mary's brother. Andrew III was unable to give full attention to the conflict with Mary and Charles, because he was engaged in a conflict with another challenger,
Albert of Austria. In the ensuing war, Andrew recovered from Albert several important towns and fortresses - including
Pozsony (Bratislava) and
Sopron - which had previously been held by the powerful Kőszegi family. After the
Peace of Hainburg, which concluded the war, was signed on 26 August, the Kőszegis threw their support to Mary's party. They rose up in open rebellion against Andrew in spring 1292, acknowledging Charles Martel as King of Hungary. Andrew´s troops subdued the rebellion by July, but in August the Kőszegis captured and imprisoned him; he was freed only four months later. During 1290, Mary's sister Elisabeth fled from
Bohemia with her son because her husband had lost favour and was executed, Mary allowed Elisabeth and her son to stay in
Naples with her, before she became a nun, but escaped and remarried to
Stephen Uroš II Milutin of Serbia (brother of Catherine's husband). Catherine's husband
Stefan Dragutin, ruler of Syrmia, was allegedly willing to support Mary and her son Charles Martel. Charles Martel granted
Slavonia to Dragutin's son,
Vladislav, in 1292, but most Hungarian noblemen and
prelates remained loyal to Andrew III. Dragutin also sought a reconciliation with Andrew, and Vladislav married Constance, the granddaughter of Andrew's uncle,
Albertino Morosini in 1293. Charles Martel died of the plague in Naples on 12 August 1295. After his death, the Pope confirmed Mary's sole rights in Hungary on 30 August 1295. She was the representative of her son at the negotiations with the Pope in 1295-96. Between 1296 and 1298, she served as regent of Naples in the absence of her consort. She served as regent the last time in 1302. After this, she lost her influence over state affairs, and retired to pious duties such as to finance convents and churches. A group of powerful lords—including the Šubići, Kőszegis and Csáks—urged Mary's husband
Charles II of Naples to send
Charles Robert, the 12-year-old son of Charles Martel, to Hungary in order to become king. The young Charles Robert disembarked in Split in August 1300. Although many lords in Croatia and Slavonian and most Dalmatian towns recognized him as king before he marched to Zagreb, Charles Robert was unsuccessful, because powerful Hungarian nobles, including the Kőszegis and Matthew Csák, reconciled with Andrew. Andrew's envoy to the Holy See noted that
Pope Boniface VIII did not support Charles Robert's adventure, either. Andrew, who had been in poor health for a while, was planning to capture Charles Robert, but he died in
Buda Castle on 14 January 1301. After Andrew's sudden death, Charles Robert hurried to
Esztergom where the Archbishop-elect,
Gregory Bicskei, crowned him with a provisional crown before 13 May. However, most Hungarians considered Charles's coronation unlawful because customary law required that it should have been performed with the
Holy Crown of Hungary in
Székesfehérvár. During the following few years, different claimants fought for the Hungarian throne until Charles was finally proclaimed king on 27 November 1308 at the
Diet in
Pest. , and finally crowned on 27 August 1310 in Székesfehérvár. Ultimately the claims of the sisters Mary and Catherine were united in a common descendant when the pair's great-great-granddaughter,
Mary of Hungary, ascended to the Hungarian throne in 1382. When the line of Charles Martel and the Angevins in Hungary died out, it was Sigismund, a remote descendant of Bela IV, whose family succeeded. ==Later life==