In the late 4th century, the lands of the Goths were invaded from the east by the Huns. In the aftermath of this event, several groups of Goths came under Hunnic domination, while others migrated further west or sought refuge inside the Roman Empire. Goths who entered the Empire by crossing the Danube inflicted a devastating defeat upon the Romans at the Battle of Adrianople in 378. These Goths would form the Visigoths, and under their king Alaric I they began a long migration, eventually establishing a Visigothic Kingdom in Spain at Toledo. Meanwhile, Goths under Hunnic rule gained their independence in the 5th century, most importantly the Ostrogoths. Under their king Theodoric the Great, these Goths established an Ostrogothic Kingdom in Italy at Ravenna.