The Middle Danube is the last large section of the Eurasian steppe, which stretches westward from Manchuria itself. Therefore, equestrian peoples have historically strived here: the Scythians, Sarmatians, Huns, Avars, and at the end of the 9th century, the Hungarians came.

Despite the adoption of Christianity, they retained a nomadic and semi-nomadic way of life for a long time. And they brought in their kingdom first Pechenegs, expelled by Polovtsians, and then Polovtsians, expelled by Mongols. It was on this basis that Khan Batu wrote a letter to King Bele IV in 1241 demanding that he hand over the refugees and submit to the Golden Horde. He intended to go further west and offered the Hungarians a share of his conquests in exchange for participation in the campaign.
Nevertheless, such a favorable offer was refused, and the Horde moved forward at the height of its power. The overall campaign was commanded by the invincible general Subudai. At the battle of Shayo he defeated the Hungarian army, and it seemed that the conquest of the country was a foregone conclusion.
The Mongols occupied the country and made a series of raids on the Archduchy of Austria, intending to gather troops and strike with all their might. But suddenly the news came that the great Khan Ugedei had died, and Batyi was forced to withdraw eastward to take part in the election of his successor.
Due to the political confrontation with the Hulaguid state and the indigenous ulus of the Mongol Empire, the Golden Horde had the opportunity to attack Hungary only after 40 years. The invasion was led by Khan Tula-Buga and the powerful beklarbek Nogai.
Three corps entered the country by the same route as Subudai and Batyi, but each of them was defeated. According to the Hungarian chronicle, the Khan returned home on the same horse as his wife, and his deputy lost the remnants of his defeated army to the cold. So how did the Hungarians defeat the nomads?

Klis Castle, Croatia
In the 13th century, Hungarians were considered barbarians in Europe only slightly better than pagans. Many still retained a nomadic way of life, plus there were quite a few steppe tribes settled in the kingdom that were only superficially Christianized. Therefore, local fathers-commanders practiced the good old steppe manner of fighting with reliance on mounted archers and light cavalry.
But this was not enough against the Mongols, and the army of Bela IV was naturally defeated. However, this was a very sensible king, who was able to draw several important conclusions from his defeat. His comparatively young age allowed him to put them into practice.
Hungary at that time had only ten stone castles, and most of them were on the western border of the country. Therefore, the Mongols had time to try only two of them — the Croatian fortress of Klis and the citadel of Esztergom, the then capital. Despite the praised Chinese throwing machines, they could not take them — the launched projectiles crashed against the walls.
Bela granted cities and feudal lords tax privileges in exchange for building stone fortifications. By the end of his reign, when he died in 1270, his country had a hundred castles, many of which were built on high ground.
At the battle of Szajó the Hungarian light cavalry was swept away by the Mongols, but the few contingents of Western knights fought with great tenacity. Bela granted the Order of the Ioannites lands on the frontier in exchange for help in building up the heavy cavalry. He guaranteed nobility to each of his subjects who managed to acquire armor and horse, gave them their own feuds.

In 1241 the Hungarians had a small band of crossbowmen who inflicted serious losses on the Mongols who were advancing across a narrow bridge. Bela asked the Pope to set him up with the Venetians and hired a thousand skilled marksmen to help train his own warriors.
Despite the rebellion of the barons, Hungary was quite prepared tactically and strategically for a new attack. Even though the royal army and the magnates had fought off the attack of Nogai and Tula Buga in 1285 alone. The presence of castles changed the military doctrine: henceforth all supplies and, if possible, the population, could be sheltered from the enemy and given a chance to beat the walls.
Khan led several tumen across the Carpathians, but suffered some losses due to cold and snow. Before him everyone fled, hiding in castles or crossing the Danube. Tula-Buga unsuccessfully tried to take several fortifications, occupied the abandoned garrison city of Pest. His men suffered greatly from hunger when they were attacked by the royal army. The Horde suffered a complete defeat, those who remained were chased for hundreds of versts by light cavalry-seekers.
The more experienced Nogai ravaged the countryside, took several wooden fortresses and even one small stone castle. Nevertheless, he lost men in useless skirmishes, and in the end his tired army was attacked by a militia of Vlachs, Sekei and Transylvanian Saxons — mostly light cavalry. Beklarbek was defeated and fled when royal flags appeared in the vicinity.
The Third Corps was defeated by the rebel barons in a proper field battle where the Tartars were opposed by knights, crossbowmen and infantry with spears. The archers drove off the mounted archers, after which they were attacked by heavy cavalry, and then the foot soldiers caught up and joined in the fun.
In 1241 Batyi brought about 50,000 men into Hungary, and the kingdom fell, though it was united. In 1285 a civil war raged here for many years, and the same size army of Tula-Buga and Nogai was defeated. Western tactics of confronting nomads justified themselves.