In
1238, Hungary was invaded by
Cuman tribes fleeing the advancing Mongol hordes. Béla sought an alliance with the Cumans, and so he granted them asylum and betrothed his son and heir, Stephen, to the daughter of a
Cuman khan named
Kuthen. The Cumans (originally a pagan shamanist people) converted to Christianity and were baptised.
Béla tried with little success to reestablish royal preeminence by reacquiring lost crown lands. His efforts, however, created a deep rift between the crown and the magnates just as the
Mongols were sweeping westward across
Russia toward
Europe. Aware of the danger, Béla ordered the magnates and lesser nobles to mobilize. Few responded. Béla also sent messages to
Pope Gregory IX and the
Holy Roman Emperor Frederick II but to no avail. The Mongols eventually routed Béla's army at the
Battle of Mohi on
April 11, 1241. His ally Kuthen had been killed by mistrustful Hungarian lords in
Pest just prior to the invasion.
Béla fled to
Austria, where Duke
Frederick of
Babenberg held him for ransom, then to
Trogir in
Dalmatia. The Mongols reduced
Hungary's towns and villages to ashes and slaughtered half the population before news arrived in
1242 that the Great
Ögedei Khan had died in
Karakorum. The Mongols withdrew, sparing Béla and what remained of his kingdom.
Upon his return to power, Béla began rebuilding his country, including a massive construction campaign which produced the system of castles as a defence against the threat of a Mongol return. This eventually happened in
1261 but this time Béla was successful in defeating them. He is greatly respected in Hungary and commonly known as "the second founder" of the kingdom.
Because of the following more and more chaotic internal situation after his death many thought him as the last ruler who brought peace to the realm. The epigram on his tomb refers this idea:
Aspice rem caram:
tres cingunt Virginis aram:
Rex, Dux, Regina,
quibus adsint Gaudia Trina
Dum licuit, tua dum viguit
rex Bela, potestas,
Fraus latuit, pax firma fuit,
regnavit honestas.