Ivan Kőszegi
Ivan Kőszegi was an influential lord in the Kingdom of Hungary at the turn of the 13th and 14th centuries. Earlier historiographical works also refer to him Ivan Németújvári. He was Palatine in 1281, between 1287 and 1288, and from 1302 until 1307, Ban of Slavonia in 1275, from 1284 until 1285 and in 1290, and Master of the treasury in 1276 and 1291.
Originating from the powerful Kőszegi family, his career was characterized by series of rebellions and violations of the law against the royal power. As one of the so-called oligarchs, he established a province in Western Transdanubia, which laid in the borderlands of Hungary with Austria, and ruled Győr, Sopron, Moson, Vas and Zala counties de facto independently of the monarchs by the 1280s. Beside his rebellions in Hungary, he waged wars with the Duchy of Austria too. Because of his plundering and looting raids against the Styrian provinces, he was dubbed as "greedy wolf" by the Austrian chronicles. During the era of feudal anarchy, he usually played a role of "kingmaker". For instance, he invited Andrew the Venetian to the throne against the reigning Ladislaus IV of Hungary three times. He initially supported Andrew III after his accession to the throne, but from 1292 he turned against the king and became a partisan of the pretender, Charles Martel, Duke of Salerno. After the extinction of the Árpád dynasty in 1301, he betrayed the House of Anjou too and played an important role in the subsequent succession war as the partisan of Wenceslaus, then Otto.
Family
Ivan was born in the 1240s into the wealthy and influential Kőszegi family, originating from the gens Héder, as one of the four sons of the powerful lord Henry I Kőszegi. His brothers were Nicholas I, Henry II – who were also elevated into high dignities during the age of the late Árpáds – and Peter, the Bishop of Veszprém from 1275 till his murder in 1289.His marriage to an unidentified noblewoman produced three children. His eldest son was Gregory, who held some minor offices before predeceased him in 1297. He left two sons, Nicholas III and Andrew, who inherited Ivan's wealth and dominion in 1308. Ivan also had an unnamed daughter, who married a certain Dominic, a familiaris of her father. During his advanced age, Ivan's younger son John the "Wolf" was born in the 1300s; after his downfall in Hungary, he integrated into the Austrian nobility, becoming ancestor of the Bernstein family. Ivan also had an illegitimate son, Nicholas, who was born in 1282 from an extramarital affair. Nicholas served as Bishop of Győr from 1308 to 1336.
Early career
Ivan Kőszegi first appeared in contemporary records in March 1265, when he participated in the Battle of Isaszeg alongside his father Henry and brother Nicholas. During the civil war between Béla IV of Hungary and his son Duke Stephen, Ivan's father was a staunch supporter of the king and led the royal army against the duke. However Stephen gained a decisive victory over his father's army, and Henry Kőszegi and his two sons were captured. His defeater Pousa Tengerdi presented the fettered prisoner Ivan Kőszegi in the ducal court of Stephen following the clash. The Kőszegis were being held as prisoners and after the Battle of Isaszeg, Béla IV was forced to accept the authority of Stephen in the eastern parts of the kingdom. On 23 March 1266, father and son confirmed the peace in the Convent of the Blessed Virgin on 'Rabbits' Island and Henry and his two sons, alongside others, were released from captivity.Stephen V ascended the Hungarian throne in May 1270, following his father's death. In response, the king's sister Anna seized the royal treasury and fled to Bohemia. Several magnates and Béla's closest advisors followed her and left Hungary, including Henry Kőszegi, who handed over Kőszeg, Borostyánkő and other castles along the western borders to Ottokar II. In the same time, Ivan Kőszegi also handed over his "two castles called Sztrigó", which laid in Zala County, to the Bohamian king. Henry and his sons had spent the next two years in exile at Ottokar's court in Prague. Their departure caused a war between Hungary and Bohemia, which lasted until the conclusion of an agreement in Pressburg in July 1271. According to their treaty, Stephen V promised that he would not assist Ottokar's opponents in Carinthia, and Ottokar II renounced the castles he and his partisans held in Hungary. The royal armies soon recaptured Kőszeg, Borostyánkő and other fortresses along the western border of Hungary.
Henry Kőszegi and his sons returned from Bohemia to Hungary following Stephen's death in the summer of 1272. His ten-year-old son Ladislaus IV ascended the throne. During his minority, many groupings of barons fought against each other for supreme power. The arriving Henry Kőszegi brutally murdered Ladislaus' cousin, Béla of Macsó, the only adult male member of the Árpád dynasty. The Kőszegis entered alliance with the Gutkeleds and the Geregyes, forming one of the two main baronial groups. Ivan's father became a key figure in the early stage of the era of so-called feudal anarchy. When Henry extended his dominance in the royal council, Ivan served as ispán of Zala County – where his initial lands mostly laid – from September 1272 to March 1273. In this capacity, he participated in private initiative Hungarian incursions into Austria and Moravia, Ottokar's realms in February 1273, along with Matthew Csák, Denis Péc, Joachim and Amadeus Gutkeled. Thereafter, Ivan functioned as ispán of Sopron County between June 1273 and September 1274. In retaliation for Hungarian incursions, Ottokar's troops invaded the borderlands of Hungary in April 1273. They captured Győr and Szombathely, plundering the western counties. The royal council sent Joachim Gutkeled and Ivan Kőszegi to recapture the castle of Győr. Kőszegi also participated in the battle at Laa in August. However Ottokar II launched a successful retaliatory strike in the autumn of 1273, and seized many fortresses again, including Győr and Sopron. Ivan successfully defended Kapuvár by destroying the dam at the river Vág and flooding the surrounding area. Thereafter he fought in Pereszteg and Lós, harassing the invading Bohemian army with hit-and-run tactics. He unsuccessfully tried to recapture Sopron from the Bohemian troops.
Ivan lost influence for a brief time after the Battle of Föveny in late September 1274, when Peter Csák defeated the united forces of the Kőszegis and the Gutkeleds. Henry Kőszegi was killed, but his sons Nicholas and Ivan managed to flee the battlefield, withdrawing their troops to the borderlands between Hungary and Austria. Thereafter Peter Csák and the young Ladislaus IV gathered an army against the Kőszegis' domain in the autumn of 1274; their troops marched into Western Hungary, pillaging the brothers' landholdings. Nicholas and Ivan barricaded themselves in the castle of Szalónak. The royal army besieged the fort, but failed to capture it because of the coming winter. Through his ambitious and unscrupulous sons, the Kőszegi family survived their paterfamilias' death.
Powerful baron
Rebellions against Ladislaus IV
Despite their violent actions against the monarch, the Kőszegis regained their influence and retook the power by the spring of 1275, when Nicholas became Palatine, and Ivan was made Ban of Slavonia, at first jointly with Nicholas Gutkeled, later solely. In this capacity, Kőszegi was responsible for the territory between the river Drava and the Kapela Mountains, while Gutkeled administered the Adriatic Coast. Ivan Kőszegi lost his dignity by the autumn of 1275, when the Csáks retook the positions in the royal council. Thereafter the Csák group launched a massive military campaign against the Kőszegi and Gutkeled dominions; while Ugrin Csák attacked Joachim Gutkeled's forces at Föveny, Peter Csák plundered and devastated the territory of the Diocese of Veszprém which headed by Bishop Peter Kőszegi, Ivan's brother. Joachim Gutkeled and the Kőszegis again removed their opponents from power at an assembly of the barons and noblemen at Buda around 21 June 1276. Ivan became Master of the treasury during that time, while Nicholas elevated into the position of Palatine of Hungary for the second time. Beside that Ivan was also ispán of Bánya ispánate, which laid in the territory of Nyitra County.Joachim Gutkeled died while battling against the Babonići in April 1277. A month later, the general assembly declared Ladislaus IV to be of age, who was also authorized to restore internal peace with all possible means. These events ended the five-year chaotic conditions in the realm. The Kőszegis and the Babonići divided the Gutkeled's province between each other on the border of Transdanubia and Slavonia. Sometimes in the second half of the 1270s, Nicholas and Ivan handed over the family's landholdings in Varaždin County to their much younger brother Henry. In the course of the division of lands between the two elder brothers in 1279, Ivan was granted Kőszeg, Borostyánkő and Sárvár, while Szentvid and Léka went to Nicholas' property. Since then, Ivan Kőszegi began to pursue an independent policy from Nicholas, which contributed to the establishment of an oligarchic province by the end of the 13th century. Simultaneously Ladislaus IV defeated his allies, the Geregyes, Ivan attempted to play off the late Stephen V's first cousin, Andrew the Venetian, against Ladislaus. Upon his invitation, the duke came to Hungary for the first time in 1278. Andrew demanded Slavonia for himself, adopting the title of "Duke of Slavonia, Dalmatia and Croatia" and marched as far as Lake Balaton with Kőszegi's troops. Duke Andrew also made Ivan as treasurer of his ducal court. In addition, Ivan Kőszegi was styled as ispán of Zala County too from 1278 to 1279. Andrew achieved nothing, however, and went back to Venice in autumn, because the Hungarian royal troops played a decisive role in Rudolf's victory over Ottokar II in the Battle on the Marchfeld on 26 August, which strengthened Ladislaus' domestic political positions. Thereafter the Kőszegi brothers pledged allegiance to Ladislaus IV in early 1279, with the mediation of the arriving papal legate, Philip, Bishop of Fermo.
The Kőszegi brothers stayed away from the conflict between Ladislaus IV and Philip of Fermo, which emerged over the question of treatment of the pagan Cumans in Hungary. Taking advantage of the chaotic situation following the papal legate's arrival, Nicholas, Ivan and Henry plundered the estates of the Diocese of Zagreb at various times in the following months. As a result, Timothy, Bishop of Zagreb excommunicated them in March 1281. According to the bishop's letter to the other prelates in the realm, Ivan Kőszegi held the ispánates of Orbász, Szana, Garics and Gecske in Slavonia and Croatia during the excommunication, and also usurped the Gerzence lordship from the diocese. Following Philip's departure from Hungary in the autumn of 1281, Ivan Kőszegi was made Palatine of Hungary by Ladislaus IV despite his earlier crime; the young king wanted revenge on those barons who have captured him during his conflict with the papal legate. As historian Jenő Szűcs noted, this appointment marked a recurrence to the anarchic-type changes of governments, which characterized the first five regnal years of the minor Ladislaus. Ivan Kőszegi actively participated in the subsequent war against the rebellious Finta Aba in mid-1281. His troops were present at the sieges of Gede and Szalánc castles. Yet, he was soon dismissed and replaced as Palatine by Matthew Csák under unknown circumstances at turn of 1281 and 1282.
, owned by Ivan Kőszegi and his heirs
Since the early 1280s, Nicholas and Ivan Kőszegi extended their influence over Sopron County, taking advantage of that both powerful leaders of the neighboring Csák clan, Matthew II and Peter had died by 1283 or 1284. During this course, Ivan embroiled in conflict with several members of the native Osl clan in the county. At the end of 1283, Ladislaus IV laid siege to Borostyánkő, which was held by Ivan. However, he resisted, forcing the king to lift the siege in early 1284. During the royal campaign, Ivan captured Herbord II Osl and held him in captivity. Subsequently, several documents refer to Ivan's violent actions against local landowners, including the Osls in the region. According to historian Gyula Kristó, Ivan brought whole Sopron County under his jurisdiction and annexed it to his emerging oligarchic province by 1285, when several local nobles were mentioned as his familiares. The advancing Kőszegi troops gradually also displaced another local strongman Conrad Győr from the region, who had once possessed huge landholdings in Moson County. Conrad's lands laid in the boundaries of interests of the two most powerful and aggressive oligarchic provinces – Ivan Kőszegi seized his villages one after another in Moson County by the mid-1280s and handed over them to their familiares and relatives, the Héderváris, while the Csáks expelled him from Pozsony County. Ivan Kőszegi also persuaded the members of the Ják clan by threat and violence to hand over to him their inherited lands in Sopron and Vas counties through unprofitable contracts.
Following his failure, Ladislaus had to reconcile with the Kőszegi brothers in the spring of 1284. While Nicholas became again Palatine, Ivan was appointed Ban of Slavonia. He held the dignity until the next year. Ladislaus spent the last years of his life wandering from place to place, staying among his Cuman subjects. Hungary's central government lost power because the prelates and the barons ruled the kingdom independently of the monarch. Ivan Kőszegi launched an individual foreign policy at the borderlands between Austria and Hungary, establishing a de facto independent province, which threatened both realms. Contemporary Austrian chronicles – the Annales Sancti Rudperti Salisburgensis and Ottokar aus der Gaal's Steirische Reimchronik – preserved Ivan's serious clash with Albert I, Duke of Austria in 1285. Accordingly, the Kőszegi troops invaded the neighboring Habsburg lands and marched into Wiener Neustadt, devastating the region and looting the settlements along the river Leitha. Initially, Albert tried to settle the conflict by negotiation, but the pillage of the Austrian and Styrian borderlands "has become commonplace" on Ivan's part. Therefore, the duke summoned his army from the Austria, Styria and Swabia and commissioned his councillor Hermann von Landenberg to lead his forces into Hungary. The Austrians intended to besiege Borostyánkő, but Ivan asked for help from his three brothers, Nicholas, Peter and Henry, who recruited an army of 1,000 people. This was the source of uncertainty in Landenberg's army. Taking advantage of their inaction, Ivan Kőszegi and his troops encircled the enemy and shot their camp with arrows. Several Austrian nobles were captured during the skirmish. After that Albert made a covenant with the Kőszegis; in return for the release of prisoners, the duke promised he will support Ivan Kőszegi's any efforts and ambitions in the Kingdom of Hungary against all his opponents, excluding the Holy Roman Empire, which was ruled by Albert's father Rudolf. The duke also proclaimed that he took Ivan under his protection and considered the Hungarian oligarch as his subject. In response, Ivan guaranteed that he put his forces for Albert's disposal, if necessary.
Archbishop Lodomer persuaded Ladislaus to convene a general assembly in the early summer of 1286 in order to reconciliation between the king and the Kőszegi brothers. There Ladislaus provided one-year grace period to the Kőszegis and their familiares. In September 1286, the king managed a self-coup, expelling members of the Kőszegi–Borsa baronial group from the royal council. Neglecting the Kőszegis' rival, the Aba clan, Ladislaus IV appointed his own loyal soldiers and lesser nobles to the high positions. Thereafter Ladislaus IV launched his fifth and last royal campaign against the Kőszegi territory in November 1286. The king seized Kőszeg, but Ivan managed to escape. He and his brothers moved to the left bank of the Danube, they also captured Pressburg Castle for a brief time. Duke Albert took advantage of the opportunity, and marched into Hungary, where his army successfully besieged and seized Pressburg from the Kőszegis in the spring of 1287. Simultaneously, the Kőszegis' allies, the Borsa brothers – Roland and James – arrived from Transtisia; they joint troops defeated Ladislaus' army at the river Zsitva in March. After a new reconciliation, Ivan Kőszegi was appointed Palatine of Hungary, he was first mentioned in this capacity in June 1287. He was also styled as ispán of Sopron County since that year until at least 1295, but it is plausible that he bore the title until his death. As Palatine, Ivan Kőszegi summoned three "general assemblies" for "the will of all nobles and free men with other social status of Vas County" in Szombathely in June 1288. This was the first time when a palatine convened a county assembly in his own right, neglecting the monarch's contribution. Gyula Kristó writes, Ivan summoned the assembly explicitly without the permission of Ladislaus. In the same year, Ivan Kőszegi exchanged his castle of Plošćica in Slavonia with the Gutkeleds for their lands in Vas County.
Ivan Kőszegi and his brothers involved in the conflict between Duke Albert and Rudolf von Hoheneck, the Archbishop of Salzburg over the affiliation of the Admont Abbey. The archbishop complained that his subject, abbot Henry entered the duke's service as captain-general of Styria and threatened those clergymen with excommunication, who held secular positions in the ducal court. In response, Albert confiscated the abbey and the surrounding Enns Valley from the archdiocese. Rudolf gathered his army at the end of 1288. He entered alliance with the Kőszegis and took an oath that he will support them in their efforts against Duke Albert. In accordance with the agreement, as the Steirische Reimchronik narrates, Ivan Kőszegi sent his 300 soldiers to invade Styria and plunder Radkersburg. The chronicles say Ivan looted the surrounding cities and settlements like a "greedy wolf". His attack soon resulted an escalation into a large-scale war in the borderlands between Austria and Hungary. Duke Albert launched a massive royal campaign with his 15,000-size army against the Kőszegis and their familiares' castles and forts in the spring of 1289. The Austrians captured at least 30 fortresses and settlements along the western borders, including Nagymarton, Németújvár, Sopron, Kabold, Szalónak, Rohonc and Óvár. Albert later launched two additional expeditions against the Kőszegis in the remaining year; his troops captured Kőszeg then Szentvid too. Ivan managed to defend Borostyánkő only on 26 September. According to Albert's chronicles, Ivan Kőszegi ordered to mutilate his 500 Austrian prisoners of war. Despite these conquests at the expense of the Hungarian realm, Ladislaus IV did not intervene in the war, and passively supported Duke Albert.
Andrew's ally then enemy
With the consent of Lodomer, Ivan Kőszegi offered the crown to the king's distant relative Andrew the Venetian. After twelve years, the pretender returned to Hungary at the beginning of 1290. He appointed Ivan Kőszegi as Ban of Slavonia and ispán of Vas County. Before Andrew was successful, however, Ivan's local enemy Arnold Hahót captured and sent him to the court of Duke Albert in Vienna. Ladislaus IV was assassinated by his Cuman subjects in July 1290. After his release, Archbishop Lodomer crowned Andrew III king in Székesfehérvár on 23 July 1290. Although Ivan Kőszegi and Lodomer jointly invited Andrew to the Hungarian throne, their motivation was different: the oligarch wanted a new controllable and weak-handed ruler to lead the kingdom instead of the unpredictable Ladislaus, while Lodomer and his suffragans were aimed to strengthen the royal power to put an end to the political anarchy. Due to his short-term interests in order to recover his lost castles and estates, Ivan initially supported Andrew's efforts. He handed over the dignity of Ban of Slavonia to his younger brother Henry by October 1290. Ivan was referred to as Master of the treasury from February to October 1291. He also administered the Bánya ispánate beside that. As Rudolf I of Germany attempted to bestow Hungary on his own son, Duke Albert of Austria, on 31 August 1290, Andrew III also had temporary interest community with the Kőszegis. At first, Andrew restored Óvár in April 1291. After the failure of the diplomatic negotiations between the two realms, Ivan and his two brothers participated in the king's military campaign in the summer of 1291, when the Hungarian troops invaded Austria, forcing Albert to withdraw his garrisons from the towns and fortresses – including Pressburg and Sopron – that he had captured two years before, many of which were held by the Kőszegis before their conquest.The Peace of Hainburg, which concluded the war, was signed on 26 August 1291. The peace treaty prescribed the destruction of the fortresses that Albert had seized from the Kőszegis, which was in the interests of both monarchs. The Kőszegis were outraged at Andrew's move. Ivan lost his dignity of Master of the treasury and his position in the royal council around October, while Nicholas was also replaced as Palatine. At the turn of 1291 and 1292, Ivan Kőszegi met papal legate John, Bishop of Iesi. During their negotiations, Ivan proclaimed that he will only recognize that king who is supported by the Holy See, which had definitely meant the betrayal of Andrew. After a few months of tension, the Kőszegi brothers rose up in open rebellion against Andrew in spring 1292, acknowledging the late Ladislaus' nephew, Charles Martel of Anjou, as King of Hungary. As a political gesture, his father Charles II of Naples perpetually donated Vas and Sopron counties to Ivan and his son Gregory, as fiefdoms, which element of feudalism was unaccustomed in Hungary. Since then the ispánate of Vas County was usurped by Ivan and his descendants without interruption until 1327. Simultaneously, in a letter, Charles Martel's mother Queen Mary of Naples authorized "her beloved follower" Ivan to launch a war against Andrew, "the usurper of the Hungarian throne and his accomplices". While Nicholas fought against the future oligarch, but still a courtly knight, Matthew III Csák in Pozsony County, Ivan was active in Vas and Zala counties. He besieged and occupied the fort of Buzádsziget from Andrew's faithful partisan Atyusz Hahót. The royal troops subdued the rebellion by July, but Ivan Kőszegi captured and imprisoned Andrew III during his journey to Slavonia for a brief time in August, as the Annales Mellicenses recorded. He entrusted his loyal castle warriors in Moson Castle to guard the prisoner. Andrew was liberated within four months, after his supporters sent their relatives as hostages to Ivan Kőszegi.
His protege Charles Martel died in August 1295, leaving Ivan without external support. Andrew III married Agnes, the daughter of Duke Albert of Austria in February 1296. Afterwards, with his father-in-law's support, Andrew launched another war against the Kőszegis in August 1296. While the Austrian troops besieged Ivan's some castles, Archbishop Lodomer excommunicated the brothers. By October, the royal army managed to capture only Kőszeg and two other forts from Ivan Kőszegi. While Ivan Kőszegi remained rebellious for the remaining part of the reign of Andrew, his brother Nicholas pledged allegiance to the monarch after the 1296 rebellion, their political orientations had separated from each other. Around that year the emerging Matthew Csák overshadowed the Kőszegis as the monarch's most dangerous enemies. The river Danube marked the border between the developing domains of the Kőszegi and Csák families. After the close of the 1298 diet, Andrew III entered into a formal alliance with five influential barons – Amadeus Aba, Stephen Ákos, Dominic Rátót, Demetrius Balassa and Paul Szécs – who stated that they were willing to support him against the "rebellious lords", which term definitely primarily covered Matthew Csák and the Kőszegi brothers. Ivan Kőszegi still supported the claim of the House of Anjou. After his election, the pro-Angevin Archbishop Gregory Bicskei absolved Ivan and Henry from the excommunication in March 1299. Bicskei resided in Transdanubia under the protection of Ivan; he even moved to Szentkereszt Castle beyond the Drava river between Koprivnica and Križevci, owned by Ivan Kőszegi, who remained the only rebellious member of his family by that year. Ivan Kőszegi was among the group of those powerful lords, who urged Charles II of Naples to send his grandson, the 12-year-old Charles Robert, to Hungary in order to become king.
However, by the young pretender's arrival in the summer of 1300, the Kőszegis and Matthew Csák were shortly reconciled with Andrew, preventing Charles' success. Historian Attila Zsoldos argued Andrew III entered into a new feudal contract with the barons in the summer of 1300: Matthew Csák and Ivan Kőszegi became "perpetual" Palatines and Andrew accepted their suzerainty over their provinces, while the king's two most powerful partisans, Amadeus Aba and Stephen Ákos were also granted this privilege. In addition to them, two co-palatines of the previous year, Roland Rátót and Apor Péc also received the title as a counterweight, according to Zsoldos' theory.
During the Interregnum
Andrew III died on 14 April 1301. With his death, the Árpád dynasty became extinct. Ivan Kőszegi was a central figure of the subsequent period of interregnum, which lasted for seven years and various claimants – Charles of Anjou, Wenceslaus of Bohemia, and Otto of Bavaria – fought for the Hungarian throne. Taking advantage of the emerging chaotic situation, Ivan cooperated with his former rival and enemy, Hermann von Landenberg and seized the Pannonhalma Abbey and its surrounding lands. His family unlawfully possessed the abbey until their downfall in 1317. In the following months, Ivan also captured the royal castle of Óvár.In the early 14th century, Hungary had disintegrated into about a dozen independent provinces, each ruled by a powerful lord, or oligarch. Among them, Matthew Csák dominated the northwestern parts of Hungary, Amadeus Aba controlled the northeastern lands, Ivan and Henry Kőszegi ruled Transdanubia and the northern parts of Slavonia, James Borsa dominated Tiszántúl, and Ladislaus Kán governed Transylvania. Ivan Kőszegi was referred to as Palatine since February 1302. In the upcoming years, seven barons held the dignity simultaneously. Majority of the historians, including Gyula Kristó and Jenő Szűcs, considered, these barons, for instance, Matthew Csák, Amadeus Aba, Ivan Kőszegi and Stephen Ákos were arbitrarily styled themselves palatines, usurping the position, which marked its devaluation. However, in accordance with Attila Zsoldos' theory, the claimants to the Hungarian throne inherited Andrew's last decision, and they were forced to accept the status quo. As Zsoldos emphasized the oligarchs recognized each other's titles, in addition to the monarchs, cathedral chapters and other institutions. Accordingly, Ivan Kőszegi was considered a "perpetual" Palatine, alongside other powerful lords. He performed his judicial role in his territorial province, in addition to Veszprém County, where acted as an judge in June 1303 in a lawsuit between the chapter of Veszprém and some local nobles over the ownership of Csopak. Beside his dignity of Palatine, Ivan was also styled as ispán of Moson and Sopron counties in 1303.
Immediately after Andrew's death, Charles of Anjou hurried to Esztergom where he was crowned king irregularly. Being Pope Boniface VIII's candidate for the Hungarian throne, Charles had always been unpopular, because the Hungarian lords feared that they would "lose their freedom by accepting a king appointed by the Church", as the Illuminated Chronicle narrates. Despite his nominal pro-Angevin standpoint in the 1290s, Ivan Kőszegi was among those lords, who supported Wenceslaus II of Bohemia. According to the narration of the Steirische Reimchronik, after Wenceslaus II met the Hungarian delegation in Hodonín in the summer of 1301, the Bohemian king sent his envoy to Kőszegi and invited him to a personal meeting. The chronicle says Kőszegi departed Hungary from his castle of Kapuvár to Bohemia. There, instead of himself, Wenceslaus II offered his eleven-year-old namesake son, who was not only Béla IV's great-great-grandson, but also the bride of the late Andrew III's daughter, Elizabeth, for the throne of Hungary. Ivan Kőszegi got a night-time thinking time. Returning to his accommodation, he found 1000 silver coins, many gold and silver treasures and scarlet broadcloth there. On the following day, Kőszegi accepted the king's offer, also referring to the generosity of the late Ottokar II, Wenceslaus' father, who had create him knight of Teutonic Order during his exile decades earlier. However, Kőszegi's main motivation behind his support was to defend his province against the House of Habsburg; Wenceslaus' opponent Charles of Anjou was the nephew of Duke Albert, who intended to enter alliance with his maternal relatives.
Ivan and Henry were among those Hungarian lords, who moved to Brno in order to welcome the young Wenceslaus, who arrived to Hungary with his father's army. While Buda fell into Wenceslaus' arms, the castle of Esztergom was conquered by Ivan Kőszegi, expelling its pro-Angevin residents, including his former ally, Archbishop Gregory Bicskei. Subsequently, he handed the fort over to Bohemian royal mercenaries in return for a significant sum of money. Wenceslaus was crowned king with the Holy Crown by John Hont-Pázmány, Archbishop of Kalocsa on 27 August 1301. Ivan also attended the ceremony. After Wenceslaus's coronation, Charles withdrew to Ugrin Csák's domains in the southern regions of the kingdom. Charles and his general Stephen Csák laid siege to Buda, the capital of Wenceslaus' kingdom, in September 1302, but the arriving Ivan Kőszegi relieved the siege. Despite Pope Boniface declared Charles the lawful king of Hungary on 31 May 1303, Ivan remained a partisan of Wenceslaus. However many lords left the court of the Přemyslid king and pledged loyalty to his rival in the following months, including Stephen Ákos and the Rátóts. Historian Tamás Kádár argues Matthew Csák, who also left Wenceslaus in the same period but did not support Charles either, had tensions with Ivan over the affiliation of Komárom County, inheriting their rivalry from their fathers, and their conflicts of interest caused his departure.
On Kőszegi's advice, as the Steirische Reimchronik emphasizes, Wenceslaus II of Bohemia came to Hungary at the head of a large army in May 1304 to strengthen his son's position. The Bohemians entered the border at Holics, Ivan and his "relatives" joined his accompaniment. Marching towards the center of the kingdom, Wenceslaus recaptured Esztergom, looting its treasury, and handed it over to Ivan Kőszegi in June. However, his negotiations in Buda with the local lords convinced him that his son's position in Hungary had dramatically weakened, thus decided to take him back to Bohemia. The young Wenceslaus did not renounce Hungary and made Ivan Kőszegi governor of his realm before leaving for Bohemia in August. The Bohemian king even took the Holy Crown with himself to Prague. After the outbreak of scandal, Ivan Kőszegi faced general uproar and anger against his person; the barons blamed him for having lost the crown jewels. In response, Ivan promised through Bishop Benedict Rád to recover the Holy Crown from Bohemia within a year, if they guarantee his safety. Thereafter, according to the Steirische Reimchronik, the "crafty palatine" sent a letter to Duke Otto of Bavaria, Béla IV's grandson, and invited him to the Hungarian throne. Accordingly, Ivan wrote in his letter that Otto can prove his ability by acquiring the crown from the Bohemian court. The Illuminated Chronicle also confirms the Kőszegis initiated the arrival of the Bavarian duke to Hungary. After signing an alliance with his cousin, Charles and Rudolph III of Austria jointly invaded Bohemia in autumn 1304. His army plundered the nearby landholdings in Sopron and Moson counties, owned by Ivan Kőszegi and marched into Moravia. According to the short-spoken Anonymi Leobiensis Chronicon, Charles launched a royal campaign against Ivan Kőszegi in 1305; receiving assistance from Rudolf III, he captured the rebellious lord' three unidentified forts. The Kőszegis looted and plundered the surrounding region with their raids from the occupied fort of Esztergom. Therefore, residing in Székesfehérvár, Archbishop Thomas excommunicated Ivan and Henry for their crimes against the burghers of Esztergom in July 1305. He also placed their provinces under interdict.
After negotiations, Wenceslaus abandoned his claim to the Hungarian throne in favor of Otto and handed the Holy Crown over to him in Brno on 9 October 1305. When Otto arrived to Sopron, he sent his envoys to the local oligarch Ivan Kőszegi, whose first question was whether he brought the crown with him. After a favorable response, Ivan Kőszegi moved to Sopron too and escorted Otto into Buda, who reached the capital around 11 November 1305. Thereafter Ivan Kőszegi retired from the public affairs and stayed away from further events. Charles seized Esztergom and Visegrád from the Kőszegis in June 1306, and thereafter also captured the many fortresses in the northern parts of Hungary, owned by Demetrius Balassa and his family. Around the same time, the Austrian troops also plundered Ivan's estates in Győr and Sopron counties. Ivan did not acknowledge Charles as his king even after Otto's imprisonment and departure from Hungary. He was absent from that assembly in October 1307, where Charles' claim to the throne was confirmed. According to the Steirische Reimchronik, Ivan Kőszegi died on 5 April 1308. His province and wealth were inherited by his grandson Nicholas.