The Talmud in Gittin tells one of the strangest stories about King Solomon. The king, in his pride, once compelled Ashmedai, the chief of demons, to serve him. Through a chain of tricks involving a magic ring bearing the Ineffable Name, Solomon bound Ashmedai and forced him to reveal certain secrets about the nature of demons and angels.

One day, Solomon grew curious. “What is the source of your strength over humans?” Ashmedai asked that the king lend him the ring so he could demonstrate. Solomon, in a moment of carelessness, handed over the ring. Ashmedai took it, threw it into the sea — where a fish swallowed it — and, with a single breath, blew Solomon four hundred leagues across the world. Ashmedai then transformed into Solomon’s exact likeness and ascended the throne of Jerusalem.

For years, the imposter ruled. He drank, he judged cases, he slept in the king’s bed. But the palace staff and the queens began to notice small wrong things. This Solomon demanded strange foods. He forgot certain customs. He kept his feet covered at all times — because demons, the tradition said, have rooster feet.

Meanwhile, the real Solomon wandered as a beggar. He traveled from city to city saying, “I, Kohelet, was king over Israel in Jerusalem” — and everyone laughed at him. He lived on scraps. He watched his own rule from the outside.

At last, fishermen caught a fish and sold it to the kitchen. A servant cut it open and found the ring. Solomon — now aged and humble — held the ring, recovered his identity, and returned to Jerusalem. Ashmedai saw him enter and fled, vanishing into the wilderness.

The rabbis drew their lesson carefully. A king who trusts demons with the Name of God will spend years learning who he is without his throne. Solomon returned wiser — and wrote, from this wandering, the book of Kohelet, Ecclesiastes, the most disillusioned book in the Tanakh.