On the following day, Rav Acha said to them, “If not for a miracle, you have caused me to be in danger.”
What happened on the previous day that led Rav Acha to say this, and why did the people put him in a potentially dangerous situation? The gemara relates that there was a “mazik” — a type of damaging demon — that resided in the Yeshiva headed by the Sage Abayei. When Abayei heard that Rav Acha was coming to town he told the people not to put him up for the night, so that Rav Acha would be forced to stay in the Yeshiva, “and perhaps a miracle will occur”, and the danger would cease. In fact, Rav Acha stayed in the Yeshiva, and when he saw the mazik he prayed for help from G-d. Each time Rav Acha bowed while saying “modim” — “thank you” — to G-d, one of the seven “skulls” (Rashi) fell from the damaging force.
But how could Abayei rely on a miracle to save Rav Acha, in order to bring safety to his Yeshiva? From the words of Abayei, “perhaps a miracle will occur”, it sounds like Abayei was not certain of Rav Acha’s safety. Perhaps a miracle would occur but perhaps it would not!
The Maharsha explains that Abayei was 100 percent certain that the prayer of the pious scholar would destroy the predator. And this would not be considered a miracle, since it was purely “natural”, according to Abayei, that G-d would answer Rav Acha’s prayer and save him. Abayei was in doubt, however, that perhaps G-d would perform a miracle to vanquish the damager before Rav Acha began to pray. And if a miracle in fact would occur for Rav Acha, this would detract from his merits in his “Heavenly accounting”, something that Rav Acha would not be happy about. Yet, since there was a mazik in the Yeshiva, Abayei felt that the certainty that Rav Acha’s presence there would kill it justified causing Rav Acha to be there. This step of ensuring safety in the Yeshiva was warranted despite Abayei’s doubt of whether the danger would be removed naturally by prayer (with no reduced merits), or “supernaturally” through a miracle (resulting in reduced merits).
Either way, Rav Acha would be safe according to Abayei’s view, and the Yeshiva would be made safe again — perhaps with a miracle, but perhaps without.
Rav Acha, on the other hand, did not view the matter in the same manner as Abayei did. In fact, his prayer was enough, without a miracle, to naturally remove the demon, one head a time. However, Rav Acha was extremely humble and modest, and did not feel that his prayer could kill the damager in a natural manner. Rather, he felt that G-d answering his pray to destroy the damager would be considered a great miracle, and his own “merits” would be reduced. Therefore, he was “upset” when he spoke to the people of the town the next day and said to them, “If not for the miracle, you would have caused me to be in great danger.” Meaning, since Rav Acha did not consider his prayer powerful enough that G-d should “naturally” answer him and save him, he had certainly suffered a loss by being “cornered” into staying in the place of the damager. He felt that only a miracle could save him. And since he was put into a situation that even if a miracle occurred and he was saved, which is how he viewed what had happened, he today had fewer merits than he had yesterday according to his humble view of himself.
“The damager appeared in the form of a serpent with seven heads. Each time Rav Acha said 'modim' in his prayers, one of the heads of the serpent fell off.”
What is special about saying “modim” — “we thank You, G-d” — that this particular part of the prayer was attributed to the death of the serpent? Our Sages (Bava Kama 16a) teach that if a person does not bow while saying the “modim” prayer during his lifetime, his spine becomes a “serpent” after seven years in the grave. Tosefot explains that since when a person says “modim” he should bow and then straighten himself like a serpent, with his head rising first, one who does not do this is punished measure-for-measure with his spine becoming in death what it should have “done” in life during prayer. In addition, the seven heads of the serpent represent the seven mystical powers of spiritual impurity, and through prayer, which is the opportunity to speak to G-d and thank Him, one can “connect” to the Divine purity. Proper prayer allows nothing but purity to remain. (Maharsha)