The following story appears at least twice in the Talmud, the more detailed version (if memory serves) near the end of the Yoma tracate. However, having recently passed it in Sanhedrin, I'm posting from there.
The context is a discussion of the laws of idolatry. As is standard practice in the Talmud, there's lots of extremely detailed discussion of hypothetical matters that don't happen in the real lives of the scholars doing the discussing. Sometimes (tho often not) these discussions eventually mention the fact that they're religious and intellectual exercises, not practical discourses. So in this case. Having spent days on the minutiae of idolatry, the Gemara wonders how it came to be that the Jews lost their interest in the practice. After all, it was clearly a major issue in the early biblical times, yet the scholars of the Talmudic era apparently had never heard of Jews engaging in it for many centuries.
If you're into modern historical analysis of documents as a primary way to decipher the events of the past, the Gemara's answer won't satisfy you, because it's a fable (or myth, or metaphor, or allegory, or something. The literary folks will better know which term it is). According to this fable, the Great Sanhedrin in Jerusalem once managed to capture the flaming lion cub of idolatry which had emerged from the Holy of Holies in the Temple. Its roars were terrible to hear, but the prophet Zachariya told them to force it into a cage and pore molten lead over it; lead apparently having special sealing properties, as any reader of Superman comics will confirm.
(If you're less than 40-some years of age and don't know what I'm talking about with the Superman allusion, forget it. Not important).
Since they were having such a good day (Et ratzon) the Sanhedrin decided also to do away with lust. They prayed that the beast of lust be handed over, and when it was they caged it for three days, waiting to see the implications. (They realized the danger of their actions, and were being careful). As they had feared, the absence of lust in the world wreaked havoc; as the Gemara describes it, during those three days even the hens stopped laying eggs. Wondering if they might request that Lust be so limited than men would have it only for their rightful wife, the Sanhedrin recognized that this would not be granted. So they blinded the Beast of Lust but then let it free; as a result, men no longer lust after their immediate female relatives, and incest became rare.
This thread is introduced and explained here.