Genesis 38 tells us an interesting story. Judah took a canaanite woman, and had three sons with her: Er, Onan and Shelah. Judah then took for his first son, Er, a wife named Tamar. We are told that Er was wicked in the sight of the Lord, and so the Lord slew him.
Judah then told his second son, Onan, to go into Tamar and give his brother a seed. That son, even though he is biologically from Onan, would be legally from Er, and would receive the inheritance of Er. Apparently Onan didn’t like this idea, so he spilled it on the ground, so as not to conceive. This displeased the Lord, so he slew Onan.
Judah then realized, ‘hey, two down, one left!’, and didn’t want his third son to die also. So he told Tamar to wait at her father’s house for his third son, Shelah, to grow up, and then he would take her as a wife. After a considerable time, we are told, Judah’s wife died. And Tamar had seen Shelah, and knew that he was grown, but she had not been given to him as a wife.
So when she learned that Judah was going to shear his sheep, she took off her widow’s clothes and dressed herself up as a prostitute. She made Judah give her his seal and his cord and his staff, which she said would be promise of payment. So Judah went into her, and she conceived.
Several months later it was discovered that Tamar had played the harlot and was pregnant. Judah called her out to be executed, but she proved that it was actually Judah’s child that she was with. Judah, to his credit, confessed his sin, and actually said that Tamar was more righteous than he. And then Tamar had twins, Perez and Zerah.
All that to say that Perez was a bastard child. Now… here’s the really cool part.
God commanded, through Moses, that a bastard child was not to hold office in Israel to the tenth generation (Deut. 23:2).
And here’s a bit of Christ’s geneaology from Matthew 1:
Judah was the father of Perez(1) and Zerah by Tamar
Perez was the father of Hezron(2),
and Hezron the father of Ram(3).
Ram was the father of Amminadab(4)
Amminadab the father of Nahshon(5),
and Nahshon the father of Salmon(6).
Salmon was the father of Boaz(7) by Rahab
Boaz was the father of Obed(8) by Ruth
and Obed the father of Jesse(9).
Jesse was the father of David(10) the king.
I thought that was a pretty cool bit of providence.