Jehoshaphat’s prayer presents a sharp contrast between the historical obedience of the Israelites and the deep ingratitude of the neighboring nations. The core of his argument rests on a bitter historical irony: the enemies now gathering to attack are the very same people the Israelites spared in the past out of devotion to God's command.
The appeal to God relies on His previous promises to save the Israelites from their enemies [רש״י]. It also highlights the sheer injustice of the current threat, pointing out that these invading nations lack any legitimate grievance or legal justification for waging war [מלבי״ם]. This hostile coalition consists of Ammon, Moab, and the inhabitants of Mount Seir, which refers to the Edomites. Although Edom is not explicitly mentioned in earlier accounts of the conflict, it becomes clear that this alliance of Transjordanian states includes them as well [ביאור שטיינזלץ].
The historical background of this relationship dates back to the Israelites' journey out of Egypt. At that time, God strictly warned the Israelites not to provoke or cause distress to these specific nations. God had granted these lands to them as their own inheritance, meaning the Israelites had no right to claim the territory for themselves [רלב״ג, מלבי״ם]. Consequently, the Israelites were forbidden from engaging them in battle [רש״י], conquering their land [מצודת דוד], or even crossing through their borders against their will [ביאור שטיינזלץ].
Out of strict obedience to God, the Israelites turned away and did not destroy these nations, allowing them to remain secure in their homeland [רלב״ג, ביאור שטיינזלץ]. This history forms the basis of a powerful moral claim. These nations should have remembered the kindness shown to them and offered help in times of distress. Instead, they completely ignore that past mercy, choosing to repay good with evil by launching a war against the exact people who once spared their lives [רש״י].