Pope Clement V appointed Gentile as papal legate with full authority and sent him to the Kingdom of Hungary in Poitiers on 8 August 1307. After the death of Andrew III of Hungary and the extinction of the Árpád dynasty in 1301, a civil war between various claimants to the throne – Charles of Anjou, Wenceslaus of Bohemia, and Otto of Bavaria – broke out. Pope Boniface's first legate, Niccolò Boccasini convinced the majority of the Hungarian prelates to accept Charles's reign, but unsuccessfully tried to acknowledge the Anjous' claim with the powerful barons of the realm. Pope Boniface who regarded Hungary as a fief of the Holy See declared Charles the lawful king of Hungary on 31 May 1303. Charles defeated his enemies by the summer of 1307 (Wenceslaus left Hungary, while Otto was imprisoned), but the so-called oligarchs still governed their province de facto independently of the royal power. Pope Clement sent his representative, Gentile in this situation. Gentile was mandated to ensure Charles' reign, to restore shattered church discipline, to recover of lost and unlawfully usurped church property and to ensure the filling of church positions in accordance with the canon law. Gentile also received permission to the use of church punishment, if necessary. Gentile arrived with two ships to Split (Spalato) in Croatia in union with Hungary at the end of May 1308. He spent the following months in various Adriatic coastal cities, Trogir (Trau), Skradin (Scardona), Zadar (Zara) and Senj (Segna), where dealt with church affairs of the Dalmatian dioceses. He was greeted by Charles I and Archbishop Thomas of Esztergom in Zagreb around early September. The companion arrived to Buda in October and Gentile was accommodated in the Dominican St. Nicholas monastery within the castle.
