Genesis 38 recounts Tamar's marriages to Judah's sons Er and Onan. Both died, and Judah promised his younger son Shelah when he grew older but did not give him to Tamar. Realizing she had been denied the expected family provision, Tamar disguised herself and encountered Judah, obtaining his seal, cord, and staff as pledges. When her pregnancy became known, Judah initially ordered punishment, but Tamar produced the identifying objects. Judah acknowledged, 'She is more righteous than I,' because he had withheld Shelah. Tamar gave birth to twins, Perez and Zerah. Perez became an ancestor of
David.