וַיַּ֤רְא הָֽאֱלֹהִים֙ אֶֽת־מַ֣עֲשֵׂיהֶ֔ם כִּי־שָׁ֖בוּ מִדַּרְכָּ֣ם הָרָעָ֑ה וַיִּנָּ֣חֶם הָאֱלֹהִ֗ים עַל־הָרָעָ֛ה אֲשֶׁר־דִּבֶּ֥ר לַעֲשׂוֹת־לָהֶ֖ם וְלֹ֥א עָשָֽׂה׃
האָט גאָט געזען זײערע מעשׂים, אַז זײ האָבן זיך אומגעקערט פֿון זײער שלעכטן װעג, און גאָט האָט חרטה געהאַט אױף דעם בײז װאָס ער האָט גערעדט זײ צו טאָן, און ער האָט עס ניט געטאָן.
Mishneh Torah, Fasts
And afterwards they should have a sage elder stand up among them [while] they sit. [If] there was not a sage elder there, they stand up a sage. [If] there was neither a sage nor an elder there, they stand up a man of stature. And he says words of submission in front of them: Our brothers, it is not sackcloth or fasting that cause [a divine punishment to end], but rather repentance and good deeds. As so did we find with Nineveh -d it is not stated about the people of Nineveh, "And God saw their sackcloth and their fasting"; but rather, "And God saw their deeds" (Jonah 3:10). And in the received tradition, it states (Joel 2:13), "Rend your hearts and not your garments." And he adds to these topics according to his ability, until they humble their hearts and repent with a complete repentance.
Kitzur Shulchan Arukh
It is a positive commandment, ordained by the Prophets, to fast on those days on which tragic events occurred to our forefathers. The purpose of the fast is to stir our hearts to reflect on the ways of repentance, and to serve as a reminder of our own evil deeds,and the deeds of our forefathers, which were as reprehensible as ours, and caused all these troubles for them as well as for us. By remembering these events we will improve our ways, as it has been said, "They will then confess their sins and the sins of their fathers" (Leviticus 26:4). Therefore, it is everyone's duty to take it to heart on those days to examine his past actions and to repent; for fasting is not the main thing, as it was said about the people of Nineveh, "And God saw their deeds" (Jonah 3:10), and our Rabbis, of blessed memory, have said, "It does not say, 'He saw their sackcloth and their fast,' but 'God saw their deeds, that they had turned away from their evil ways.'" Fasting is only a preparation for repentance. Therefore those who while fasting, spend the time taking walks, and doing trivial things, take hold of the least important aspect of the fast, while ignoring the essence [of the fast.]
Shulchan Arukh, Orach Chayim
The order of prayer on these fasts, consisting of three sections:Every day from the seventh day of withholding rain, following the established order of these fasts, the people gather and go out with the ark to the city square. The entire community assembles, covering themselves with sackcloth and placing ash from burnt material (meaning ash from something that has been burned, distinct from regular dust, which is also called ash) on the ark and on the Torah scroll. This is done to intensify the weeping and to humble their hearts. One of the people takes the ash and places it on the head of the leader and the head of the court, in the place where they put on tefillin, so they may be ashamed and repent. Each person then takes and places it on his own head. Afterwards, they arrange a wise elder among them, and if there is no wise elder, they appoint a sage. If neither is present, they appoint someone of stature and say before them words of rebuke, meaning words that provoke and stir the heart towards repentance. They emphasize that neither sackcloth nor fasting alone cause repentance, but rather true repentance and good deeds. We find in the case of the people of Nineveh, it is not said, 'God saw their sackcloth and their fasting,' but rather, 'God saw their deeds.' In accordance with his ability, the person addressing them continues with these matters until he softens their hearts, and they fully repent. After concluding these words of rebuke, they stand in prayer and appoint a prayer leader suitable for these fasts. If the one who spoke the words of rebuke is fit to pray, he prays. If not, someone else is chosen to lead the prayer. Who is fit to lead the prayer on these fasts? A person who is accustomed to praying regularly, is familiar with reading from the Torah, Prophets, and Writings, is morally upright, has toiled in the field, has not had a child or relative who transgressed, has an empty house of transgressors, has not acquired a bad reputation in his youth, is humble, pleasant to people, and has a pleasant voice. If he is elderly, with all these qualities, he is honored. If not, as long as he possesses all these qualities, he should lead the prayer.