King Béla 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. In next summer, a rebellious lord captured and imprisoned Stephen's son, Ladislaus. Shortly thereafter, Stephen unexpectedly fell ill and died.
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 Robert of Esztergom baptised him on 18 October. The child, heir apparent from birth, was named after Saint Stephen, the first King of Hungary.
Béla 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.
A royal charter of 1246 mentions Stephen as "King, and Duke of Slavonia". Apparently, in the previous year, Béla 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 had invited to settle in the plains along the river Tisza. Elizabeth had been baptized, but ten Cuman chieftains present at the ceremony nevertheless took their customary oath upon a dog cut into two by a sword.
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 up 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 of 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 of Styria in favor of Ottokar II.
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 of Esztergom 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, 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 after 1 August 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 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 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 Tikh 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 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 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.
The senior King died on 3 May 1270. His daughter, Anna, seized the royal treasury and fled to Bohemia. Henry Kőszegi, Nicholas Geregye, and Lawrence Aba—Béla'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 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 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 St. Stanisław" in Cracow and visited his brother-in-law, Boleslaw the Chaste, Duke of Cracow 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". Stephen also met Ottokar II on an island of the Danube near Pressburg (present-day Bratislava, Slovakia), but they only concluded a truce.
Stephen launched a plundering raid into Austria around 21 December. King Ottokar invaded the lands north of the Danube in April 1271 and captured a number of fortresses, including Dévény (now Devín, Slovakia), Pressburg and Nagyszombat (present-day Trnava, Slovakia). Ottokar routed Stephen at Pressburg on 9 May, and at Mosonmagyaróvár on 15 May, but Stephen won the decisive battle on the Rábca River on 21 May. Ottokar withdrew from Hungary and Stephen chased his troops as far as Vienna. The two kings' envoys reached an agreement in Pressburg on 2 July. According to their treaty, Stephen promised that he would not assist Ottokar's opponents in Carinthia, and Ottokar renounced the castles he and his partisans held in Hungary. The Hungarians soon recaptured Kőszeg, Borostyánkő and other fortresses along the western border of Hungary.
According to the Life of Stephen's saintly sister, Margaret, who had died on 18 May 1270, Stephen was present when the first miracle attributed to her occurred on the first anniversary of her death. Stephen, in fact, initiated Margaret's canonization at the Holy See in 1271. In the same year, Stephen granted town privileges to the citizens of Győr. He also confirmed the liberties of the Saxon "guests" in the Szepesség region (present-day Spiš, Slovakia), contributing to the development of their autonomous community. On the other hand, Stephen protected the Archbishop of Esztergom's rights against the conditional nobles of the archbishopric who attempted to get rid of their obligations.
Ban Joachim Gutkeled kidnapped Stephen's ten-year-old son and heir, Ladislaus and imprisoned him in the castle of Koprivnica in the summer of 1272. Stephen besieged the fortress, but could not capture it. Stephen fell ill and was taken to the Csepel Island. He died on 6 August 1272. Stephen was buried near to the tomb of his sister, Margaret, in the Monastery of the Blessed Virgin on Rabbits' Island.
Stephen's wife, Elizabeth was born around 1239, according to historian Gyula Kristó. A charter of her father-in-law, Béla IV, refers to one Seyhan, a Cuman chieftain as his kinsman, implying that Seyhan was Elizabeth's father. Stephen's first child by Elizabeth, Catherine was born around 1256. She was given in marriage to Stephen Dragutin, the elder son and heir of King Stephen Uroš I of Serbia, in about 1268. Her sister, Mary was born around 1257 and married the future Charles II of Naples in 1270. Their grandson, Charles became King of Hungary in the first decade of the 14th century.
According to historian Gyula Kristó, Stephen's third (unnamed) daughter was the wife of Despot Jacob Svetoslav. Stephen's third (or fourth) daughter, Elizabeth, who was born in about 1260, became a Dominican nun in the Monastery of the Blessed Virgin on Rabbits' Island. She was appointed prioress in 1277, but her brother, Ladislaus, kidnapped and married her to a Czech baron, Zavis of Falkenstein, in 1288. Stephen's youngest daughter, Anna, was born in about 1260. She married Andronikos Palaiologos, son and heir of the Byzantine Emperor, Michael VIII.
Stephen's first son Ladislaus was born in 1262. He succeeded his father in 1272. Stephen's youngest child, Andrew, was born in 1268 and died at the age of 10.