Testament of Solomon 1
5 Now when I Solomon heard this, I entered the Temple of God, and prayed with all my soul, night and day, that the demon might be delivered into my hands, and that I might gain authority over him. And it came about through my prayer that grace was given to me from the Lord Sabaoth by Michael his archangel. [He brought me] a little ring, having a seal consisting of an engraved stone, and said to me: "Take, O Solomon, king, son of David, the gift which the Lord God has sent thee, the highest Sabaoth. With it thou shalt lock up all demons of the earth, male and female; and with their help thou shalt build up Jerusalem. [But] thou [must] wear this seal of God. And this engraving of the seal of the ring sent thee is a Pentalpha."
Gittin 68aBabylonian Talmud
Solomon said to them: Where is it found? They said to him: Bring a male demon and a female demon and torment them together. It is possible that they know where, and due to the suffering they will reveal the place to you. Solomon brought a male demon and a female demon and tormented them together, and they said: We do not know where to find the shamir. Perhaps Ashmedai, king of the demons, knows. Solomon said to them: Where is Ashmedai? They said to him: He is on such-and-such a mountain. He has dug a pit for himself there, and filled it with water, and covered it with a rock, and sealed it with his seal. And every day he ascends to Heaven and studies in the heavenly study hall and he descends to the earth and studies in the earthly study hall. And he comes and checks his seal to ensure that nobody has entered his pit, and then he uncovers it and drinks from the water in the pit. And then he covers it and seals it again and goes. Solomon sent for Benayahu, son of Jehoiada, a member of the royal entourage, and gave him a chain onto which a sacred name of God was carved, and a ring onto which a sacred name of God was carved, and fleeces of wool and wineskins of wine. What did Benayahu do? He went and dug a pit lower down the mountain, below the pit dug by Ashmedai, drained the water, and plugged it with the fleeces of wool so that Ashmedai’s pit was emptied. And he dug a pit higher up the mountain, above Ashmedai’s pit. And he poured the wine into it so that the wine filled Ashmedai’s pit, and he plugged the lower and upper pits that he dug. He climbed up and sat in a tree.
Notes and References
"... A well-known passage in Gittin 68a tells of King Solomon that he ruled not only over men but also over demons. He was desirous of obtaining the mythical shamir, that by its aid the stones for the building of the Temple might be cut without the employment of iron. So he ordered Ashmedai, the king of the demons, to be brought before him ... It is nor surprising that in Tobit (3.8), which assumedly had been composed in the second or first pre-Christian century, hence more than three hundred years after the events narrated in Herodotus, Ashmedai had become simply the evil spirit. And since here he brings misfortune on the young bride Sarah by repeatedly killing her husbands, he appears also in the Testament of Solomon as causing evil to brides and destroying conjugal life, though this function is not at all in the spirit of the old Ashmedai legend. In other later accounts from the amoraic period, such as in Pesachim 110, he is also brought in connection with various other superstitious notions ..."
Kaminka, Armand The Origin of the Ashmedai Legend in the Babylonian Talmud (pp. 221-224) The Jewish Quarterly Review, 1922
Thank you for your submission!