2 Chronicles 20:1-4 (ESV)
20 After this the Moabites and Ammonites, and with them some of the Meunites,[a] came against Jehoshaphat for battle. 2 Some men came and told Jehoshaphat, “A great multitude is coming against you from Edom,[b] from beyond the sea; and, behold, they are in Hazazon-tamar” (that is, Engedi). 3 Then Jehoshaphat was afraid and set his face to seek the Lord, and proclaimed a fast throughout all Judah. 4 And Judah assembled to seek help from the Lord; from all the cities of Judah they came to seek the Lord.
2 Chronicles 20:14-22 (ESV)
14 And the Spirit of the Lord came[a] upon Jahaziel the son of Zechariah, son of Benaiah, son of Jeiel, son of Mattaniah, a Levite of the sons of Asaph, in the midst of the assembly. 15 And he said, “Listen, all Judah and inhabitants of Jerusalem and King Jehoshaphat: Thus says the Lord to you, ‘Do not be afraid and do not be dismayed at this great horde, for the battle is not yours but God’s. 16 Tomorrow go down against them. Behold, they will come up by the ascent of Ziz. You will find them at the end of the valley, east of the wilderness of Jeruel. 17 You will not need to fight in this battle. Stand firm, hold your position, and see the salvation of the Lord on your behalf, O Judah and Jerusalem.’ Do not be afraid and do not be dismayed. Tomorrow go out against them, and the Lord will be with you.”
18 Then Jehoshaphat bowed his head with his face to the ground, and all Judah and the inhabitants of Jerusalem fell down before the Lord, worshiping the Lord. 19 And the Levites, of the Kohathites and the Korahites, stood up to praise the Lord, the God of Israel, with a very loud voice.
20 And they rose early in the morning and went out into the wilderness of Tekoa. And when they went out, Jehoshaphat stood and said, “Hear me, Judah and inhabitants of Jerusalem! Believe in the Lord your God, and you will be established; believe his prophets, and you will succeed.” 21 And when he had taken counsel with the people, he appointed those who were to sing to the Lord and praise him in holy attire, as they went before the army, and say,
“Give thanks to the Lord,
for his steadfast love endures forever.”
22 And when they began to sing and praise, the Lord set an ambush against the men of Ammon, Moab, and Mount Seir, who had come against Judah, so that they were routed.