Ezra 8:21, 23
Then I proclaimed a fast there at the river of Ahava, that we might humble ourselves before our God, to seek from Him the right way for us and our little ones and all our possessions…23 So we fasted and entreated our God for this, and He answered our prayer.
The time of this prayer took place at the beginning of the second return of the Jews from Babylon, led by Ezra. Zerubbabel led the first return in 586 B. C. as ordered by King Cyrus of Persia. This group of 50,000 built dwellings for themselves, and they also built the altar of God and began offering sacrifices. They also built the foundation of the temple; then after a sixteen year delay (being under great duress from the surrounding peoples), under the leadership of Haggai and Zechariah, they built and completed the temple (Ezra 1-6).
Between the time of the completion of the temple (516 B.C.) and the time of the second return (458 B.C.) we have a 59-year gap (between chap. 6 and chap. 7 of Ezra). During this period, the events of the book of Esther took place, in which the Jews were spared total annihilation through miraculous events wrought by prayer and fasting with much courage (Esther 4:3, 5:1).
Soon after these events, Artaxerxes and his seven counselors sent Ezra (a priest and a scribe who lived in Babylon) to Jerusalem. He was to take with him bulls, rams, lambs, money, and whatever he needed to do the Lord’s work, along with volunteers; for he was ordered by the king to set magistrates and judges over the people to teach them the law of God and of the king, and to enforce punishment on all who didn’t obey the laws (Ezra 7:26).
So Ezra gathered leading men of Israel to go with Him, along with their wives and children (about 8,000), and they set out on the long journey.
But before they had gotten far they stopped by the river of Ahova and camped for three days. There Ezra proclaimed a fast in order to humble themselves before God and to pray for their protection and leading on the way.
Ezra could have asked for an escort by the king (Ezra 8:22); but since he had previously bragged to the king about how the hand of their God is upon all those for good who seek Him, I suppose he felt compelled just to pray and trust God for protection—lest the king would see in him a lack of faith and likewise bring to God a bad reputation.
Therefore, they prayed and trusted in God for protection; and the hand of the Lord was upon them, and He delivered them from the hand of the enemy and from ambush along the road (Ezra 8:31).