David composed this psalm during a military campaign against Edom that also involved Joab and Abishai (2 Sam. 8:13; 1 Chr. 18:12). It is not unusual for victories by a general to also be assigned to his overlord. There was a line of command from David down to Joab and down to Abishai. So each of them are assigned the credit for the subsequent victories over the Edomites, with perhaps each of them leading different sections of the Israelite army in separate aspects of the campaign.
Yet it is clear from the psalm that initially things had not gone well. Verses 1-4 are a lament in which David complains that God has abandoned the land to its enemies. Nevertheless his understanding of why defeat comes is important to notice. It was not the power of their enemies that brought on the defeat – instead it was the anger of God for his people’s sins. The psalmist acknowledged that this was the case, and such an acknowledgement is necessary before victory will be provided by God.
Still the lament contains a ray of hope because David acknowledges in verse 4 that God has provided a banner under which his people may be safe. A banner was a sign indicating the presence of an important person, and here the one with the banner is God.
The salvation indicated by the banner is further described in verses 5-8. David knows that God can give complete deliverance in answer to prayer to those he loves (v. 5). The basis of his optimism is a special message that God had given, probably at the Tabernacle through one of the priests (v. 6a). In this message God promises national deliverance (he mentions several parts of the country in verses 6b-7) and great victories (he mentions several enemies in derogatory terms in verse 8). It is important to note that God, not David, is speaking in verses 6b-8. David’s comfort came from God’s promises.
David responds in verses 9-12. He is fully aware that defeating Edom will be hard because of its fortified cities (if any of you have been to the Nabatean city of Petra in Jordan, you would have seen what a fortified city looked like, and how difficult it would have been to capture – before the Nabtateans ruled it, it was an Edomite city). The only one who can lead them to victory is God, the very one who had previously not helped them (v. 10). David does not trust in human initiatives (v. 11) but in the Lord who can give complete victory (v. 12).
The lessons of the psalm are obvious. First, if are not experiencing victories over spiritual enemies, the reason is that we have offended God and he is chastising us. Second, we have to repent of our sins and ask God for restoration. Third, we are to base future victories on the large promises of God and not on inadequate human abilities (a description that describes all human abilities). Fourth, even when we are restored to his favour, we have to continue to pray for his presence and power.