Where did the holy, maternal seed of Moshiach originate? In Sodom! And what event received this first honor? Incest! From this union came Ruth and Na'amah, wives of Boaz and Shlomo, respectively.
And what misdeed initiated the fraternal, genealogical line of Moshiach? A union between Tamar, draped as a roadside prostitute, and Yehuda, her former father-in-law whom she seduced, from which Peretz was born. Her intent, to be sure, was sublime and pure.
Although beneficent, G-d introduced bad into the world to balance out the good, to give mankind free choice, to provide merit for their good choices and demerits for their bad ones. Similarly, G-d infuses counter-forces, or "dark" forces, into the world to fight and balance out holy forces, or sources of "light". No initiative for the sake of sanctity can exist without its corresponding counter-measure that promotes desecration.
Being that Moshiach, the holiest of souls, is predestined to escort the world to its ultimate level of sanctity, a mighty counter-measure of "darkness" has the capacity to resist this "light". To give rise to the holy Moshiach, the seeds that will unite in creating this person must find a way to materialize, by removing resistance to their existence. Only under a facade of "darkness" can these seeds retain their holiness and survive. Under the guise of illicitness, this condition fools the unsuspecting opposition. This counter-force of darkness simply does not expect to find holiness within an apparent taboo, thus resistance is effectively eliminated.
Lot and his 2 daughters escaped from Sodom as this huge city and its 4 neighboring cities underwent an unnatural upheaval and infernal destruction. Only 10 generations earlier the Great Flood erased all life from the face of the earth. Now too, they thought, a similar event repeated itself. They thought they were the world's only survivors. The oldest daughter therefore proposed to her sister a scheme to inebriate her father so progeny can result from intercourse with him. Their intention came from this purity of wish.
Camouflaged by otherwise abhorrent acts, this "purity of light" managed to dodge the suspicions of the opposer. This opposition never suspected an act of incest or "prostitution" requires his intervention or resistive force. The seeds thereafter will need to find future conditions that masquerade as seemingly improper situations where their holiness can dwell, to remove the bad opposer's suspicion and survive yet another critical juncture along the holy genealogical path.
Once married, the seeds of Boaz and Ruth established the House of David. Thereafter, the seeds of Na'amah and Shlomo finalize the familial dynasty towards Moshiach.
Events cast in murky circumstances typify the path of this pure light that must not call attention to itself, but rather must hide in places of impurity, if not from generation to generation, then at least at important genealogical intersections, to assure its survival, until it finally arrives to its final destination and revelation - the end-product that manifests as Moshiach.
Take the story of aging Boaz, the greatest personage of that generation, who decides to marry the younger Ruth. The circumstances that lead to this moment are all fascinating, but we focus on one of them. He calls together the elders to rule whether or not he can marry Ruth, who derives from the most despicable nation, Moav. The elders rule a Moabite can never enter the Jewish nation, but a Moabitess - can. Boaz then marries her - and passes away the same day! The elders, taken aback, now think perhaps they ruled incorrectly. So the seed of Oved comes to life with an aura of suspicion cast upon him.
Now take the story of Oved's son, Yishai. He was extremely righteous, one of the few in the world who never sinned. After having 7 sons, he rethinks his grandfather's affairs, and suddenly, as if a screw loosened in his brain, is seized with terror. Could it be, in fact, his grandfather Boaz illicitly married Ruth? In his righteousness he wants to prevent his virtuous wife from bedding with a Moabite such as he, in fact, may be. So he shuns her. His sons later realize the separation. Years later, knowing Hashem wants for people to live normally on earth, he sets his eyes upon his Gentile maidservant. He conditions a marriage with her as follows: He releases her from servanthood and to become a Jewess if he, in fact, is a kosher Jew; But she remains a servant in case he's not kosher, in which case she retains her Gentile status and is permitted to lay with him.
Seeing Yishai's wife in anguish from the separation, the maidservant offers her a scheme, to exchange herself just as Rachel had replaced herself with Leah the night she wedded Jacob, 10 generations earlier. Months later the boys note the mother's pregnancy and tell the father she and her fetus must be killed. The father agrees but points out a "technicality"; Casting aspersion on the mother's conduct automatically casts this same aspersion upon the boys themselves, for if she prostituted herself for this child, who is to say she didn't do the same previously. So they decide to banish the child-to-be, David, from their sight, by sending him off to shepherd their flock. Chances are also good this shepherd could die in these far off pastures, where lions and bears roam. Only when Shmuel anointed David did Yishai realize his son's legitimacy.
Then the whole story of David, after his anointment, yet unable to reign for another 7 years; His horrible years when haunted by King Saul who seeks to kill him; And later, when his own sons seek to kill him. Then there's the episode of the so-called "sinful" marriage to BatSheva, the mother-to-be of King Shlomo. Only before his death, does King David manage to usurp control from competing forces to crown Shlomo.
The final story of this characteristically shadowy trail is still unwritten. Before long, Moshiach will reveal himself, and the world will transform into a utopia. Darkness itself will shed its cover to reveal the inner good that gave it its life-force in the first place.