Biblical citations in the hymnal: Psalm 90, 2 Corinthians 4:16-18, Romans 8:18, Psalm 46:1-3
Psalm 90: "1 Lord, you have been our dwelling place in all generations. 2 Before the mountains were brought forth, or ever you had formed the earth and the world, from everlasting to everlasting you are God.
"3 You return man to dust and say, 'Return, O children of man!' 4 For a thousand years in your sight are but as yesterday when it is past, or as a watch in the night. 5 You sweep them away as with a flood; they are like a dream, like grass that is renewed in the morning: 6 in the morning it flourishes and is renewed; in the evening it fades and withers.
"7 For we are brought to an end by your anger; by your wrath we are dismayed. 8 You have set our iniquities before you, our secret sins in the light of your presence.
"9 For all our days pass away under your wrath; we bring our years to an end like a sigh. 10 The years of our life are seventy, or even by reason of strength eighty; yet their span is but toil and trouble; they are soon gone, and we fly away. 11 Who considers the power of your anger, and your wrath according to the fear of you? 12 So teach us to number our days that we may get a heart of wisdom. 13 Return, O LORD! How long? Have pity on your servants! 14 Satisfy us in the morning with your steadfast love, that we may rejoice and be glad all our days. 15 Make us glad for as many days as you have afflicted us, and for as many years as we have seen evil. 16 Let your work be shown to your servants, and your glorious power to their children. 17 Let the favor of the Lord our God be upon us, and establish the work of our hands upon us; yes, establish the work of our hands!"
2 Corinthians 4:16-18: "16 So we do not lose heart. Though our outer self is wasting away, our inner self is being renewed day by day. 17 For this light momentary affliction is preparing for us an eternal weight of glory beyond all comparison, 18 as we look not to the things that are seen but to the things that are unseen. For the things that are seen are transient, but the things that are unseen are eternal."
Romans 8:18: "For I consider that the sufferings of this present time are not worth comparing with the glory that is to be revealed to us."
Psalm 46:1-3: "1 God is our refuge and strength, a very present help in trouble. 2 Therefore we will not fear though the earth gives way, though the mountains be moved into the heart of the sea, 3 though its waters roar and foam, though the mountains tremble at its swelling."
+++
The text is public domain:
1 O God, our help in ages past,Our hope for years to come,Our shelter from the stormy blast,And our eternal home:2 Under the shadow of Thy throneThy saints have dwelt secure;Sufficient is Thine arm alone,And our defense is sure.3 Before the hills in order stoodOr earth received her frame,From everlasting Thou art God,To endless years the same.4 A thousand ages in Thy sightAre like an evening gone,Short as the watch that ends the nightBefore the rising sun.5 Time, like an ever-rolling stream,Soon bears us all away;We fly forgotten as a dreamDies at the op'ning day.6 O God, our help in ages past,Our hope for years to come,Be Thou our guard while troubles lastAnd our eternal home!
+++
Psalm 90 is the main source for the hymn. Verse 1 appears in the hymn's first and last verses (specifically "our eternal home"); verse 2 in the third verse; verse 4 in the fourth verse; and verses 5 and 10 (and possibly also verse 6) in the fifth verse.
2 Corinthians 4:16-18 and Romans 8:18 both seem to be the basis for the line "Our hope for years to come" in the first and sixth verses.
The passage from Psalm 46 appears in the first, second, and sixth verses. Verse 1 appears in the line "O God, our help in ages past" in the first and sixth verses, and elements from verses 1 and 3 are combined in the line "Our shelter from the stormy blast" in the first verse. The passage is referred to only generally in the second verse.
+++
Since the hymn's first and last verses begin with the same two lines about God's being our help, the hymn presents a structural image of God's encompassing protection: "You hem me in, behind and before," as it's put in Psalm 139:5.