Symbolism, Imagery, Allegory
As Ezra leads a group of exiles out of Babylon and back to Jerusalem, he organizes a fast to obtain God's protection from ambushes:
Then I proclaimed a fast there, at the river Ahava, that we might deny ourselves before our God, to seek from him a safe journey for ourselves, our children, and all our possessions. For I was ashamed to ask the king for a band of soldiers and cavalry to protect us against the enemy on our way, since we had told the king that the hand of our God is gracious to all who seek him, but his power and his wrath are against all who forsake him. So we fasted and petitioned our God for this, and he listened to our entreaty. (NRSV Ezra 8:21-23)
The logic behind this fast seems to be the same as the logic behind sacrifice: if you give up something important to you, you can receive a boon or a benediction from God. In this case, Ezra and his people require security.