Notes on the Bible, by Albert Barnes, [1834], at sacred-texts.com
This psalm is entitled merely "A Song of Degrees." Its author, and the occasion on which it was composed, are unknown. The contents of the psalm accord well with the supposition that it may have been written after the return from the Babylonian captivity, and may have been designed to strengthen and comfort those who were engaged in rebuilding the city, and restoring the ancient worship, either against the Samaritans and those who opposed them Neh 6:12-13, or against the lukewarmness of a part of the people themselves. There is nothing, however, so exclusively applicable to that time as to make it necessary to suppose that it was composed on that occasion. There is, indeed, evidence in the psalm Psa 125:5, that there were some among the people who were disposed to turn away from the service of Yahweh, or who were perverse and rebellious; but such a state of things was not special to the time of the return from the captivity, nor was it special to the Jews, for it has occurred often; it exists still. The psalm is designed to encourage those who were disposed to trust in the Lord, by the assurance that they would be safe; that the blessing of God would be upon them; and that the church was firm and secure.
They that trust in the Lord - His people; his friends. It is, and has been always, a characteristic of the people of God that they trust or confide in him.
Shall be as mount Zion - The mountain which David fortified, and on which the city was at first built, Sa2 5:6-9. The name Zion became also the name by which the entire city was known.
Which cannot be removed, but abideth for ever - A mountain is an emblem of firmness and stability; and it is natural to speak of it as that which could not be removed. There is something more than this, however, intended here, as there is some ground of comparison especially in regard to Mount Zion. This must have been either the idea that Zion was particularly strong by position, or that it was under the divine protection, and was therefore safe. Most probably it refers to Zion as a place secure by nature, and rendered more so by art.
As the mountains are round about Jerusalem - Hebrew, "Jerusalem - the mountains are round about her." Jerusalem, except on the north, is encompassed with hills or mountains, so that although the city was built on hills - Zion, Moriah, Bezethah, Acra - it was itself surrounded by hills higher than any of these, and was, in a certain sense, in a valley. See the notes at Mat 2:1. Compare the notes at Psa 48:1-14.
So the Lord is round about his people ... - As Jerusalem is thus protected by the hills around, so the people of God are protected by Yahweh. He surrounds the church; he is exalted far above the church; he guards the approaches to the church; he can defend it from all its foes. Under his protection it is safe. Jerusalem, as surrounded by hills and mountains, has thus become an emblem of the church at all times; its security was an emblem of the security of all who trust in the Lord.
For the rod of the wicked - Margin, as in Hebrew, "wickedness." The word "rod" - the staff, the scepter, the instrument of inflicting punishment - here means dominion, power, that condition in which the wicked are commonly found, as one of prosperity or power. God will not deal with the righteous as the wicked are often dealt with: that is, God will not give his people prosperity as he does them. The righteous will be afflicted, and will be placed in circumstances to keep them from putting forth their hands to iniquity; that is, from indulging in iniquity. They will be afflicted; they will be kept in the ways of virtue and religion by trial; they will not be left to act out the depravity of the heart as the wicked are.
Shall not rest upon - Permanently abide; or, be the constant condition of the righteous. They may be prospered, but they must expect that there will be changes, and that God will so deal with them as to keep them from putting forth their hands to iniquity.
The lot of the righteous - The righteous, considered as the "lot" or portion of the Lord. The language is derived from dividing a land by lot (compare Psa 105:11; Psa 74:2); and the idea is, that the "lot" pertaining to the Lord, or his "portion" among people, is the righteous.
Lest the righteous put forth their hands unto iniquity - Lest the effect of prosperity should be to lead them away from God - like the wicked. Hence, they are dealt with in a different manner. They are afflicted; they are thus kept under proper discipline, and their hearts and lives are made what they should be. The statement in this verse, therefore, accords with the uniform statements in the Scriptures, that prosperity is dangerous to the spiritual interests of people, and that, therefore, people are often afflicted in order that they may be led to seek higher interests than those which pertain to this life. The connection here seems to be, that God will defend his people, even as Jerusalem was defended by hills and mountains; but that the real welfare and prosperity of his people was not what the wicked seek - wealth and honor - but the favor of the Lord. Another meaning may, however, be suggested in regard to this verse, which to some may appear more probable than the one above. It is this: that the "rod" - the dominion of the wicked - of bad rulers - of a harsh and oppressive government - will not always be upon the people of God, lest, being crushed, they should be led to acts of iniquity; or lest, being kept from the free service of God, they should abandon themselves to sin.
Do good, O Lord, unto those that be good ... - To the good; to the pious. Let them be under the divine protection. Possibly this is not merely a prayer, but is expressive of the belief of the psalmist as to what would occur under the divine administration - that the favor of God would rest upon his people.
As for such as turn aside unto their crooked ways - The wicked. Those who leave the right or straight path, and wander in forbidden ways. The word here rendered "crooked ways" occurs nowhere else except in Jdg 5:6, where it is rendered "by-ways," meaning unfrequented paths or roads; narrow and crooked paths, remote from the highways, or the ways commonly traversed. Hence, the word means also paths of sin - as deviations from the straight road which man should travel.
The Lord shall lead them forth with the workers of iniquity - They shall be dealt with as sinners. They shall be punished. The allusion is to backsliders; to those who forsake the worship of God; who cease to do "good;" who, though among the professed people of God, wander from him in by-paths and forbidden ways. The idea is, that their profession of religion will not save them; that they will not obtain the divine blessing merely because they are avowedly the people of God, or are numbered among them, but that they will be treated as all other sinners are: they will be led forth with all the wicked, and will be treated like them. Compare Eze 33:12-13; Mat 7:22-23; Mat 25:11-12.
But peace shall be upon Israel - Upon the real Israel; upon the true people of God. Gal 6:16; Isa 54:13; Isa 55:12; Isa 57:2; Isa 66:12; Joh 14:27; Joh 16:33; Eph 2:17; Phi 4:7.