During the migration of nations, Slavs settled in the territory of present-day Bratislava. Under the leadership of the Frankish merchant Samo the ‚Samo’s Empire‘ was established – the first known tribal union of Slavs. It was preceded by raids from fighting tribes of nomadic Avarians and the necessity for a defence against them. After Samo’s death, Samo’s Empire disintegrated into principalities. By the subsequent joining of these principalities, the state of Greater Moravia was founded. The fame of this empire reached its peak in the reign of its most significant sovereign, Svätopluk. The beginning of its gradual cessation is associated with the first written reference to the castle of Bratislava in the annals of Salzburg of 907, when a battle took place near the castle between Hungarian suites and the Bavarian army. The old Hungarians were victorious, subsequently occupying the eastern part of Greater Moravia.