The Gemara (Shabbos 156b) tells a story with Shmuel and a non-Jewish astrologer named Avlait. They observed people entering a swamp. Avlait said that a certain man would not emerge from the swamp because a snake would bite and kill him. Shmuel said that he would not die if he was a Jew ("for astrology does not control the fate of a Jew [ein mazal l'Yisrael], and prayer will help him" - Rashi).
The man emerged from the swamp alive. Shmuel and Avlait approached him. Avlait found a dead, chopped up snake in the man's pack; the man had inadvertently killed the snake when chopping reeds in the swamp. Shmuel asked him what he did to deserve being saved - turns out the guy pulled a sleight-of-hand trick earlier in the day to save an impoverished coworker from embarrassment when the coworker hadn't been able to afford anything for the workplace potluck lunch. Shmuel concluded that tzedaka (charity) saves one from death.
Questions:
- Whose prayer did Shmuel think would help - the man's or Shmuel's? Was Shmuel specifically praying for the man's safety? (Presumably he was too far away to warn him of the danger initially).
- If prayer was enough to save the man from the astrologically predicted danger, why did Shmuel afterwards attribute the man's safety to his good deed?
- Is the Gemara saying that either prayer or good deeds/charity can save someone from a bad mazal, or are both necessary?