Stephen V of Hungary (, , ; before 18 October 1239 – 6 August 1272) was King of Hungary and Croatia between 1270 and 1272, and Duke of Styria from 1258 to 1260. He was the oldest son of King Béla IV of Hungary and Maria Laskarina. King Béla had his son crowned king at the age of six and appointed him Duke of Slavonia. Still a child, Stephen married Elizabeth, a daughter of a chieftain of the Cumans whom his father settled in the Great Hungarian Plain.

King Béla IV appointed Stephen Duke of Transylvania in 1257 and Duke of Styria in 1258. The local noblemen in Styria, which had been annexed four years before, opposed his rule. Assisted by King Ottokar II of Bohemia, they rebelled and expelled Stephen's troops from most parts of Styria. After Ottokar II routed the united army of Stephen and his father in the Battle of Kressenbrunn on 12 July 1260, Stephen left Styria and returned to Transylvania.

Stephen forced his father to cede all the lands of the Kingdom of Hungary to the east of the Danube to him and adopted the title of junior king in 1262. In two years, a civil war broke out between father and son, because Stephen accused Béla of planning to disinherit him. They concluded a peace treaty in 1266, but confidence was never restored between them. Stephen succeeded his father, who died on 3 May 1270, without difficulties, but his sister Anna and his father's closest advisors fled to the Kingdom of Bohemia. Ottokar II invaded Hungary in the spring of 1271, but Stephen routed him. Next summer, a rebellious lord captured and imprisoned Stephen's son, Ladislaus. Shortly thereafter, Stephen unexpectedly fell ill and died.

Childhood (1239–1245)

thumb|left|220px|Stephen's father, King [[Béla IV of Hungary (from the Illuminated Chronicle)|alt=King Béla IV of Hungary]]

Stephen was the eighth child and first son of King Béla IV of Hungary and his wife, Maria, a daughter of Theodore I Lascaris, Emperor of Nicaea. He was born in 1239. Archbishop of Esztergom Robert baptised him on 18 October. The child, heir apparent from birth, was named after Saint Stephen, the first King of Hungary.

Béla IV and his family, including Stephen, fled to Zagreb after the Mongols had annihilated the royal army in the Battle of Mohi on 11 April 1241. The Mongols crossed the frozen Danube in February 1242 and the royal family ran off as far as the well-fortified Dalmatian town of Trogir. The King and his family returned from Dalmatia after the Mongols unexpectedly withdrew from Hungary in March.

Junior king

Duke of Slavonia (1245–1257)

thumb|Seal of Stephen's wife, [[Elizabeth the Cuman|alt=Seal of Elizabeth the Cuman]]

A royal charter of 1246 mentions Stephen as "King, and Duke of Slavonia". Apparently, in the previous year, Béla IV had his son crowned as junior king and endowed with the lands between the river Dráva and the Adriatic Sea, according to historians Gyula Kristó and Ferenc Makk. The seven-year-old Stephen's provinces — Croatia, Dalmatia and Slavonia — were administered by royal governors, known as bans.

In a letter addressed to Pope Innocent IV in the late 1240s, Béla IV wrote that "[o]n behalf of Christendom we had our son marry a Cuman girl". The bride was Elizabeth, the daughter of a leader of the Cumans whom Béla IV had invited to settle in the plains along the river Tisza. Elizabeth had been baptised, but ten Cuman chieftains present at the ceremony nevertheless took their customary oath upon a dog cut into two by a sword.

Duke of Transylvania and Styria (1257–1260)

When Stephen attained the age of majority in 1257, his father appointed him Duke of Transylvania. Stephen's rule in Transylvania was short-lived, because his father transferred him to Styria in 1258. Styria had been annexed in 1254, but the local lords rose in rebellion and expelled Béla IV's governor, Stephen Gutkeled, before Stephen's appointment. Stephen and his father jointly invaded Styria and subdued the rebels. In addition to Styria, Stephen also received two neighboring counties — Vas and Zala — in Hungary from his father. He launched a plundering raid in Carinthia in the spring of 1259, in retaliation for Duke Ulrich III of Carinthia's support of the Styrian rebels.

Stephen's rule remained unpopular in Styria. With support from King Ottokar II of Bohemia, the local lords again rebelled. Stephen could preserve only Pettau (present-day Ptuj, Slovenia) and its region. On 25 June 1260, Stephen crossed the river Morava to invade Ottokar's realm. His military force, which consisted of Székely, Romanian and Cuman troops, routed an Austrian army. However, in the decisive Battle of Kressenbrunn King Béla's and Stephen's united army was vanquished on 12 July, primarily because the main forces, which were under King Béla's command, arrived late. Stephen, who commanded the advance guard, barely escaped from the battlefield. The Peace of Vienna, which was signed on 31 March 1261, put an end to the conflict between Hungary and Bohemia, forcing Béla IV to renounce Styria in favor of Ottokar II.

Conflicts and civil war (1260–1270)

thumb|[[Baba Vida, the medieval fortress at Vidin in Bulgaria: Stephen captured it in 1261.|alt=Vidin Castle]]

thumb|left|220px|Stephen V is crowned by his father, [[Béla IV of Hungary|Béla IV (from the Illuminated Chronicle).|alt=Stephen V is crowned by his father.]]

Stephen returned to Transylvania and started to rule it for the second time after 20 August 1260. He and his father jointly invaded Bulgaria and seized Vidin in 1261. His father returned to Hungary, but Stephen continued the campaign alone. He laid siege to Lom on the Danube and advanced as far as Tirnovo in pursuit of Tsar Constantine Tikh of Bulgaria. However, the Tsar succeeded in avoiding any clashes with the invaders and Stephen withdrew his troops from Bulgaria by the end of the year.

Stephen's relationship with Béla IV deteriorated in the early 1260s. Stephen's charters reveal his fear of being disinherited and expelled by his father. He also accused some unnamed barons of inciting the old monarch against him. On the other hand, Stephen's charters prove that he made land grants in Bihar, Szatmár, Ugocsa, and other counties which were situated outside Transylvania.

Archbishops Philip Türje and Smaragd of Kalocsa undertook to mediate after some clashes occurred between the two kings' partisans in the autumn. According to the Peace of Pressburg, which was concluded around 25 November 1262, Béla IV and his son divided the country and Stephen received the lands to the east of the Danube. When confirming the treaty on 5 December, Stephen also promised that he would not invade Slavonia, which had been granted to his younger brother, Béla, by their father. On this occasion, Stephen styled himself "Junior King, Duke of Transylvania and Lord of the Cumans".

A Bulgarian nobleman, Despot Jacob Svetoslav, sought assistance from Stephen after his domains, which were situated in the regions south of Vidin, were overrun by Byzantine troops in the second half of 1263. Stephen sent reinforcements under the command of Ladislaus II Kán, Voivode of Transylvania to Bulgaria. The Voivode routed the Byzantines and drove them out of Bulgaria. Stephen granted Vidin to Jacob Svetoslav, who accepted his suzerainty.

The reconciliation of Stephen and his father was only temporary. Stephen confiscated the domains of his mother and sister, Anna — including Beszterce (present-day Bistrița, Romania) and Füzér — which were located in the lands under his rule. Béla IV's army crossed the Danube under Anna's command sometime after the autumn of 1264. She besieged and took Sárospatak and seized Stephen's wife and children. Voivode Ladislaus Kán turned against Stephen and led an army, which consisted of Cuman warriors, to Transylvania. Stephen routed him at the fort of Déva (now Deva, Romania). King Béla's Judge royal, Lawrence, son of Kemény arrived at the head of a new army and forced Stephen to retreat to Feketehalom (now Codlea, Romania). The Judge royal lay siege to the fortress, but Stephen's partisans relieved it. Stephen launched a counter-offensive and forced his father's army to retreat. He gained a decisive victory over his father's army in the Battle of Isaszeg in March 1265. The two archbishops mediated a new consolidation between father and son, which confirmed the 1262 division of the country. Béla IV and Stephen signed the peace treaty in the Convent of the Blessed Virgin on the Rabbits' Island (now Margaret Island in Budapest) on 23 March 1266.

During the civil war in Hungary, Stephen's vassal, Despot Jacob Svetoslav, submitted himself to Tsar Constantine I Tih of Bulgaria. In the summer of 1266, Stephen invaded Bulgaria, seized Vidin, Pleven and other forts, and routed the Bulgarians in five battles. Jacob Svetoslav again accepted Stephen's suzerainty and was reinstalled in Vidin. From then on, Stephen used the title "King of Bulgaria" in his charters.

Béla IV and Stephen together confirmed the liberties of the "royal servants", from then on known as noblemen, in 1267. A double marriage alliance between Stephen and King Charles I of Sicily — Stephen's son, Ladislaus married Charles's daughter, Elisabeth, and Charles's namesake son married Stephen's daughter, Mary — strengthened Stephen's international position in 1269. Confidence was never restored between Béla IV and Stephen. On his deathbed, the old King requested King Ottokar II of Bohemia to give shelter to his daughter Anna and his partisans after his death.

Reign (1270–1272)

thumb|[[Kingdom of Hungary (1000–1301)|Kingdom of Hungary in the second half of the 13th century|alt=Map of the Kingdom of Hungary]]

thumb|King Stephen V as depicted in the [[Chronica Hungarorum]]

thumb|Stephen's funeral crown|alt=Stephen V's funeral crown

The senior King died on 3 May 1270. His daughter, Anna, seized the royal treasury and fled to Bohemia. Henry I Kőszegi, Nicholas Geregye, and Lawrence I Aba — Béla IV's closest advisors — followed her and handed over Kőszeg, Borostyánkő (Bernstein, Austria) and their other castles along the western borders to Ottokar II. Instead of leaving Hungary, Nicholas III Hahót garrisoned Styrian soldiers in his fort at Pölöske, and made plundering raids against the nearby villages. Stephen nominated his own partisans to the highest offices; for instance, Joachim Gutkeled became Ban of Slavonia, and Matthew II Csák was appointed Voivode of Transylvania. Stephen granted Esztergom County to Archbishop Philip who crowned him king in Esztergom on or after 17 May.

The Polish chronicler Jan Długosz writes that Stephen made "a pilgrimage to the tomb of Stanislaus of Szczepanów" in Kraków and visited his brother-in-law, Bolesław V the Chaste, Duke of Kraków at the end of August. The two monarchs renewed "the old alliance between Hungary and Poland" and entered into an alliance "to have the same friends and the same enemies".