Theodulf was born in Spain around the year 760 AD, but fled the Iberian peninsula because of the Muslim conquest. Charlemagne promoted him to Bishop of Orleans and he served as a scholar, an educator, a poet, and an adviser to the emperor. He was a church reformer, opposing the use of icons. He wrote books on baptism and the Holy Spirit. When Charlemagne died in 814, his sons squabbled over the empire, and his son Louis the Pious imprisoned Theodulf on suspicion of conspiring with his enemies.
The story is told that Theodulf composed this hymn while in prison. As Louis passed by his cell on a Palm Sunday, Theodulf sang the hymn and Louis released him on the spot. The story is likely untrue, as Theodulf died four years later, most believe in prison and of poisoning.
Whatever the story, the Lord used Theodulf to write a beautiful and classic hymn that has survived for 1200 years.