While Bebek resided in Galicia to govern the province, Charles of Durazzo claimed to the Kingdom of Hungary, after his position in Naples consolidated. Both Elizabeth and Mary remained unpopular among the majority of Hungarian barons who supported Charles against them. Internal war emerged between Charles, the Queens and Sigismund of Luxembourg, the fiancé of Mary, and after Charles marched towards
Buda, Mary renounced the crown without resistance and Charles was crowned king of Hungary in
Székesfehérvár on 31 December 1385. Charles II tried to reconcile the opposing baronial leagues, as a result several supporters of Mary remained in office. In January 1386, the King appointed Bebek as Judge royal. His person was acceptable to both parties: years ago, he led an army to support Charles in Naples, while he was a loyal bannerman to Mary and
Nicholas Garai. in February 1386 Even after Charles' coronation, Mary (and Elizabeth), who continued to live in the royal palace in Buda, performed royal duties, thus a dual power emerged in Hungary at the beginning of 1386. Despite being Mary's partisan, Bebek styled himself simply "Judge royal" in his title, without the mention of either Charles or Mary. Historian Iván Bertényi argued the office became independent during the weak central power, and gradually elevated to the status of "Judge of the Country". Through January, Bebek issued royal charters and initiated lawsuits in the name of both Charles and Mary. As Bertényi noted, Bebek represented the unity and indivisibility of the realm in those weeks. But, nevertheless, this proved to be only a temporary political situation. According to medieval chronicles, Emeric Bebek – alongside Ban Nicholas Garai, Bishop
Bálint Alsáni,
Thomas Szentgyörgyi and his father George Bebek – was present at the assassination of Charles II on 7 February, when Mary's supporter
Blaise Forgách attacked and mortally wounded the king. Mary was restored to the throne, with her mother ruling in her name. In the southern territories, the Horvat brothers,
John and
Paul rose up in open rebellion on behalf of the murdered king's son,
Ladislaus of Naples. The queens commissioned Bebek to restore law and order in
Slavonia, where the majority of noblemen had supported Charles. He first appeared as
Ban of Slavonia in March 1386, while the dignity of Judge royal remained vacant. However, soon, he was re-installed as Judge royal in a few months. Beside that he also governed
Bars County until 1388. In July 1386, the queens decided to visit the southern counties of the kingdom to personally calm the opposition. Accompanied by Garai and a modest following, they were ambushed en route and attacked by the Horvats' soldiers in
Gorjani. Garai and Forgách were killed by the rebels and their head were sent to Charles's widow
Margaret, while the queens were captured and imprisoned. Under these circumstances, Bebek acknowledged Sigismund's right as consort and swore allegiance to him. During the period of interregnum (from Mary's imprisonment on 25 July 1386 to Sigismund's coronation as co-ruler on 31 March 1387), Bebek again styled himself as "
judex curie regie", distinguished his office from the royal authority. Bebek was present, when Sigismund met his wife in
Zagreb on 4 July 1387 after her successful rescue from imprisonment. Mary officially remained the co-ruler with Sigismund, but her influence on the government was minimal (while Queen Elizabeth was murdered during captivity). Bebek was mentioned as
ispán of
Bereg County from 1388 to 1390, then
ispán of
Liptó and
Turóc Counties from 1390 to 1392, while also served as castellan of
Boldogkő. Emeric and Derek Bebek was granted
Szokoly Castle (today Sokoľ,
Slovakia) and nine villages in
Sáros County in 1387. In 1391, Sigismund donated
Gönc Castle to the Bebek brothers. All landholdings formerly had belonged to the dominion of provincial lord
Amadeus Aba and his clan. Through Bishop Paul Horvat, Ladislaus of Naples's envoys secretly contacted with Bebek on 7 October 1390, beside other barons. ==Later career==