A lamentation, the psalm is set in Judah’s exile in Babylon.
v.1-3 Sitting by a stream of water, weeping for Zion, the exiles are required by their captors to sing a song of Zion.
v.4-6 The exiles protest: how can we sing in a foreign land? They vow to remember Jerusalem.
v.7-9 The poem ends in imprecation (a call for retribution against Edom and Babylon). See Jer 51:56.
The captives are treated most cruelly; but, the psalm contrasts with the NT teaching that we should give thanks in all circumstances (1 Thes 5:18).