The Visigoth king who died stopping Attila inspired Tolkien's Théoden
Theodoric I spent decades fighting the Roman general Aëtius, then joined him in 451 to halt Attila the Hun. His Visigoths helped win the Battle of the Catalaunian Plains, but the king fell in the fighting. Tolkien drew on his story for King Théoden of Rohan.
Theodoric became king of the Visigoths in 418, succeeding Wallia, whose people Rome had ordered out of Iberia into Gaul. He completed their settlement in Aquitaine, Novempopulana and Narbonensis, then exploited Rome's weakness to push south. When Emperor Honorius died and Joannes usurped power in 423, he tried to seize the key road hub of Arelate, but Aëtius, backed by Hunnic troops, saved it. The later emperor Avitus lived at Theodoric's court and tutored his sons.
In 436, with Rome busy against Franks who had sacked Cologne and Trier, he besieged Narbo Martius to gain the Mediterranean and the Pyrenean roads. The general Litorius, again with Hunnic help, drove him back to his capital, Tolosa, and rejected his peace offer, yet Theodoric won the decisive battle there, and Litorius died of his wounds as a Gothic prisoner. Avitus then brokered a treaty. Marriage ties followed: one daughter wed the Vandal prince Huneric, who later cast her off and sent her back, and in 449 another married the Suevic king Rechiar.
When Attila invaded Gaul, Avitus arranged an unlikely alliance between Theodoric and Aëtius. Seeing the danger to his own kingdom, Theodoric brought his entire army and his sons Thorismund and Theodoric. The allies relieved the city of Aurelianum in June 451, pursued the Huns and met them near Troyes, with Theodoric commanding the right wing.
His troops were decisive, but he did not survive. Jordanes gives two versions: that he was thrown from his horse and trampled, or that the Ostrogoth Andag struck him with a spear. Found only the next day, he was buried by his warriors on the battlefield in Gothic fashion, and Thorismund was immediately chosen king. His sons then ruled in succession, murdering one another in turn, until Euric died naturally in 484.
Source: Theodoric I