The theme of God as a shepherd was common in ancient Israel and Mesopotamia. For example, King Hammurabi, in the conclusion to his famous legal code, wrote: "I am the shepherd who brings well-being and abundant prosperity; my rule is just... so that the strong might not oppress the weak, and that even the orphan and the widow might be treated with justice." This imagery and language was well known to the community that created the Psalm, and was easily imported into its worship.