John (IV) Kórógyi, Count of Castell (, ; 1400 – July/October 1456) was a Hungarian baron and military leader in the first half of the 15th century, who served as Judge royal for a brief time in 1440, and Ban of Macsó from 1447 to 1456. In this capacity, he was responsible for maintaining the defense system against the Ottoman incursions, and distinguished himself as a military leader in several battles, including the decisive Siege of Belgrade.

Early life John (IV) originated from the Kórógyi family, which possessed lands in southern Transdanubia and northern Slavonia, primarily around the town Osijek. He was the only known son of Philip IX Kórógyi and Helena Jolsvai. He had two sisters, Catherine and Maria, who married lords John Perényi and Ákos Csupor, respectively. He was part of a respectable and influential kinship, his grandparents, for instance, were barons Stephen Kórógyi and Leustach Jolsvai.Engel: Genealógia (Kórógyi family)

John was born around 1400 or a few years earlier, since he was still a minor in 1411, when his name is first mentioned. He reached adulthood by late 1410s; as a member of the royal court, where he probably grew up, he enjoyed King Sigismund's trust because he is mentioned in documents issued from 1417 to 1426 as a person who went on the king's behalf to investigate various cases and report on them. in 1418–1419, he was involved in that legal process, when the Kórógyis (his uncles) unsuccessfully attempted to acquire the lordships of Darnóc (today Slatinski Drenovac in Croatia) and Atyina for their family, but King Sigismund annulled the contracts. John Kórógyi continued his family's lawsuit against the Cikádor Abbey (in Bátaszék) regarding the distribution of transport duties in Osijek. Upon the order of Sigismund, bans Peter Cseh de Léva and Stephen Újlaki convoked a general assembly for the nobles of Baranya County to discuss the case. After conducting the investigation, which verified the authenticity of previous royal grants, Sigismund confirmed the abbey's right to two-thirds of the customs in Osijek in November 1429.

His father Philip died in 1432 or 1433, leaving his only son John as head of the family (his uncles had also died by then, apparently without male heirs). Thereafter, In 1433–1434, John Kórógyi was involved in a lawsuit against his sisters, Catherine and Maria, regarding the distribution of income in the lordship of Nádasd (with its fort and the surrounding, altogether 55 villages). According to the indictment, although John promised, as part of their agreement, to give part of the proceeds to his sisters after their father's death, he failed to keep his promise from the beginning. In February 1434, King Sigismund ruled in favor of John's widowed mother, Helena Jolsvai, and his two sisters, granting them four years of usufruct. In exchange, John was granted the two-thirds portion of the lordship Csapa in Valkó County (present-day Čepin, Croatia).

In December 1434, when William II, Count of Castell traveled to Pressburg as part of a delegation to visit the imperial court of Sigismund, he met John Kórógyi there, whom he considered a relative due to his parents' previous (1417) contract and correspondence with Philip Kórógyi. William and John Kórógyi concluded a mutual inheritance agreement in Pressburg: if William or his descendants died without an heir, their lordship with all its appurtenances could be inherited by John or his descendants. And although Kórógyi received permission to use the title of Count of Castell from William, it was stipulated that he would not have any rights over the county and its appurtenances or subjects until William's family died out. The same was stipulated by the parties regarding the Kórógyi estates in Hungary. As a sign of kinship, William called himself Count of Castell (comes de Castell) and Lord of Kórógy (dominus de Korogd). Similarly to his father, John was granted the right to use red wax seal. Since William was in a difficult financial situation by then, the wealthy Kórógyi relatives promised him an advantage in the event of a possible inheritance.

Career During the civil war Kórógyi's career began to rise during Albert's short reign. In May 1439, he turned to the Holy See to grant privileges (indulgence and absolution) to the Holy Trinity Parish Church in Osijek, of which he was the patron. He was mentioned among the magnates in 1439. In this capacity, he took part in Albert's unfortunate campaign against the Ottoman Empire in the autumn of that year. On 17 September 1439, he was present at that war council in Tüdőrév (near Titel along the Danube) with the surrounding magnates and nobles, where they decided to renew the campaign against the Ottomans the following year. Albert promised at this time that he would personally organize and lead the army to be raised, and the prelates, barons and nobles (altogether 62 people) present at the council pledged to fully support the king in collecting the extraordinary war tax. Albert fell seriously ill during the campaign. The dying king, who knew that his wife Elizabeth was pregnant, willed his realms to his posthumous child if his wife gave birth to a son, under the guardianship of his widow and his cousin, Frederick of Austria.

Following the death of Albert in October 1439, his pregnant wife Elizabeth took control of Hungary as regent. Kórógyi, belonging to the group centered around his relative Ladislaus Garai, supported her aspirations to secure the accession of the unborn child to the throne. However, fearing a new Ottoman invasion of Hungary, the Diet of Hungary, which was composed of the majority of the Hungarian lords and prelates, refused to accept the deceased king's last will and invited Władysław III of Poland to the Hungarian throne. They also wanted to persuade the pregnant queen dowager to marry the new king. Although Elizabeth seemingly agreed to accept their decision, but shortly afterwards, she left Buda for Komárom (present-day Komárno, Slovakia) with her followers, including Kórógyi. She gave birth to a son, named Ladislaus, there in February 1440. Possibly after the coronation of Ladislaus V as King of Hungary in May 1440, Elizabeth appointed Kórógyi as Judge royal, which was the second most important dignity in the kingdom. He replaced the pro-Vladislaus lord Stephen Báthory. Despite Ladislaus' valid coronation (in Székesfehérvár with the stolen Holy Crown), The Hungarian Diet stood by its position, and when Vladislaus I entered Buda in the same month, Queen Elizabeth and her entourage, including Kórógyi, fled first to Győr, and from there to Sopron, taking the infant king with her. Initially, there were attempts at compromise between the two parties. For instance, Vladislaus I acknowledged Kórógyi as Judge royal, and, as Elizabeth's envoys, Garai, Kórógyi and other nobles were granted safe-conduct on 15 June 1440 to participate in the Diet convoked to Buda. As pro-Elizabeth barons, Garai and Kórógyi attempted to mediate between Elizabeth and Vladislaus, but this effort remained unsuccessful. As a result, Kórógyi was present, when the Diet confirmed the election of Vladislaus and declared the infant Ladislaus' coronation invalid on 29 June 1440.

Armed confrontation then became inevitable. Kórógyi held the dignity of Judge royal until at least October 1440. The Diet of Hungary later did not consider his tenure legitimate. Elizabeth established her rival government in Western Transdanubia, Slavonia and Croatia, where the local powerful barons remained stalwart and loyal to the queen. Kórógyi held the title of Ban of Macsó and ispán of Pozsony County in that year; these titles were not recognized by the Diet, and others simultaneously filled the positions. The civil war broke out in the autumn of 1440, after John Hunyadi, who emerged from obscurity and became a leading political and military ally of Vladislaus I, attacked Győr but was unable to take the garrisoned city. Concurrently, Ladislaus Garai instigated a rebellion in the south. Hunyadi, together with Nicholas Újlaki, annihilated Garai's army at Bátaszék on 1 January 1441. Kórógyi also fought in the battle, leading his troops, and he, along with Garai himself, barely managed to flee from the battlefield, according to Johannes de Thurocz's Chronica Hungarorum. During the clashes in the region, Nicholas Újlaki captured one of Kórógyi's fort, Harsány (or Szársomlyó) in Baranya County.

Marginalization After Elizabeth's defeat, Kórógyi swore loyalty to Vladislaus I in March 1442. Despite that, for the remainder of Vladislaus' reign, Kórógyi remained out of favor, far from the royal court and national politics. At this time, his name only appears in local property matters. In 1443, he complained to the court of Nicholas Újlaki, Ban of Macsó, for being denied possession of Sotin in Valkó County after his disagreement with his mother-in-law Helena of Corbavia, which estate he claimed through his wife Elizabeth Garai. In March 1443, the court at Erdut heard the case. In September 1443, Benedict, a canon of the Diocese of Bosnia complained that John Garai (son of Desiderius) expropriated the estates Drenovac and Pleternica to Elizabeth, Kórógyi's wife, and her sister Catherine, the wife of Paul Hédervári.

Kórógyi participated in that diet held in Buda on 15 April 1444, where Vladislaus I – in the presence of papal legate Julian Cesarini – swore to renew the war against the Ottomans in the coming summer. Three days later, Kórógyi was among the more than two hundred nobles who confirmed Vladislaus' decree.

Return to the elite Vladislaus I was killed in the Battle of Varna on 10 November 1444. This allowed Kórógyi to return to national politics in the years when the child Ladislaus V, who was raised in Vienna, was not in practice the ruler of Hungary and Croatia in his absence. Kórógyi was among the magnates, i.e. he was a member of the extended royal council from 1444 to 1447. He became a strong ally and supporter of his former enemy, captain-in-chief then regent John Hunyadi, who de facto ruled the kingdom since 1445. As an expression of his gratitude, Kórógyi donated his estate Veresegyház in Bács County to John Hunyadi and his sons, Ladislaus and Matthias in March 1447. He participated in that Diet in September 1447, where his former ally Ladislaus Garai was elected Palatine of Hungary. Succeeding Garai, Kórógyi was installed as Ban of Macsó in late 1447, holding the dignity until his death. He served in this capacity alongside Stephen Bebek at least until August 1448, while Nicholas Újlaki, the most powerful baron and landowner in the region, was also styled as a kind of "perpetual" ban for the rest of his life. Beside that, Kórógyi also administered Bács, Baranya, Bodrog, Syrmia, Tolna and Valkó counties as part of his dignity's honour. In this role, Kórógyi played an important role in maintaining the southern border defense system, consisting of a chain of fortresses, set up against Ottoman incursions and large-scale invasions. As a ban, he held his official residence in Osijek, from where he judged disputes between the nobles and church institutions of Valkó, Baranya and the surrounding counties. He issued many charters there throughout 1448.