I mean, the origin of the Mournersâ Kaddish, according to one medieval midrash, was to get rid of a ghost/undead spirit (see here and here):
A tale of R. Akiva. He was walking in a cemetery by the side of the road and encountered there a naked man, black as coal, carrying a large burden of wood on his head. He seemed to be alive, and was running under the load like a horse. R. Akiva ordered him to stop.âHow comes it that a man does such hard work?â he asked. âIf you are a servant and your master is doing this to you, then I will redeem you from him. If you are poor and people are avoiding you, then I will give you money.ââPlease sir,â the man replied. âDo not detain me, because my superiors will be angry.ââWho are you,â Rabbi Akiva asked, âand what have you done?â
The man said, âThe man whom you are addressing is a dead man. Every day they send me out to chop wood.ââMy son, what was your work in the world from which you came?â âI was a tax collector, and would favour the rich and kill the poor.â âHave your superiors told you nothing about how you might relieve your condition?â âPlease sir, do not detain me, for you will irritate my tormentors. For such a man [as I], there can be no relief. Though I did hear them say somethingâbut no, it is impossible. They said that if this poor man had a son, and his son were to stand before the congregation and recite the prayer Barekhu and the congregation were to answer amen, and the son were also to say Yehe shme mevarakh, they would release him from his punishment. But this man never had a son. He left his wife pregnant and he did not know whether the child was a boy. And if she gave birth to a boy, who would teach the boy Torah? For this man does not have a friend in the world.â Immediately Rabbi Akiva took upon himself the task of discovering whether this man had fathered a son, so that he might teach the son Torah and install him at the head of the congregation to lead the prayers. âWhat is your name?â he asked. âAkiva,â the man answered. âAnd the name of your wife?â âShoshnia.â âAnd the name of your town?â âLodkiya.â
Rabbi Akiva was deeply troubled by all this and went to make his inquiries. When he came to that town, he asked about the man he had met, and the townspeople replied, âMay his bones be ground to dust!â He asked about the manâs wife, and he was told, âMay her memory be erased from the world!â He asked about the manâs son, and he was told, âHe is a heathenâwe did not even bother to circumcise him.â Rabbi Akiva promptly circumcised him and sat him down before a book. But the boy refused to receive Torah. Rabbi Akiva fasted for forty days. A heavenly voice was heard to say, âFor this you mortify yourself?â âBut Lord of the Universe,â Rabbi Akiva replied, âIt is for You that I am preparing him.â
Suddenly the Holy Blessed One opened the boyâs heart. Rabbi Akiva taught him Torah, the Shema, and Birkat haMazon. He presented the boy to the congregation and the boy recited Barekhu and they answered Barukh hamevorakh leâolam vaâed. At that very moment the man was released from his punishment. The man immediately came to Rabbi Akiva in a dream and said, âMay it be the will of the Lord that your soul find delight in the Garden of Eden, for you have saved me from the sentence of Gehenna.â ⊠For this reason, it became customary that Maâariv on the night after Shabbat is led by a man who does not have a father or a mother, so that he can say Kaddish and Barekhu.