About that time, Judah left his brothers and went to stay with a man named Hirah in the town of Adullam.
There Judah met a Canaanite girl, the daughter of a man named Shua, and married her. Judah had sexual relations with her,
and she became pregnant and gave birth to a son, whom Judah named Er.
Later she gave birth to another son and named him Onan.
Still later she had another son and named him Shelah. She was at Kezib when this third son was born.
Judah chose a girl named Tamar to be the wife of his first son Er.
But Er, Judah's oldest son, did what the Lord said was evil, so the Lord killed him.
Then Judah said to Er's brother Onan, "Go and have sexual relations with your dead brother's wife. It is your duty to provide children for your brother in this way."
But Onan knew that the children would not belong to him, so when he was supposed to have sexual relations with Tamar he did not complete the sex act. This made it impossible for Tamar to become pregnant and for Er to have descendants.
The Lord was displeased by this wicked thing Onan had done, so the Lord killed Onan also.
Then Judah said to his daughter-in-law Tamar, "Go back to live in your father's house, and don't marry until my young son Shelah grows up." Judah was afraid that Shelah also would die like his brothers. So Tamar returned to her father's home.
After a long time Judah's wife, the daughter of Shua, died. After Judah had gotten over his sorrow, he went to Timnah to his men who were cutting the wool from his sheep. His friend Hirah from Adullam went with him.
Tamar learned that Judah, her father-in-law, was going to Timnah to cut the wool from his sheep.
So she took off the clothes that showed she was a widow and covered her face with a veil to hide who she was. Then she sat down by the gate of Enaim on the road to Timnah. She did this because Judah's younger son Shelah had grown up, but Judah had not made plans for her to marry him.
When Judah saw her, he thought she was a prostitute, because she had covered her face with a veil.
So Judah went to her and said, "Let me have sexual relations with you." He did not know that she was Tamar, his daughter-in-law. She asked, "What will you give me if I let you have sexual relations with me?"
Judah answered, "I will send you a young goat from my flock." She answered, "First give me something to keep as a deposit until you send the goat."
Judah asked, "What do you want me to give you as a deposit?" Tamar answered, "Give me your seal and its cord, and give me your walking stick." So Judah gave these things to her. Then Judah and Tamar had sexual relations, and Tamar became pregnant.
When Tamar went home, she took off the veil that covered her face and put on the clothes that showed she was a widow.
Judah sent his friend Hirah with the young goat to find the woman and get back his seal and the walking stick he had given her, but Hirah could not find her.
He asked some of the people at the town of Enaim, "Where is the prostitute who was here by the road?" They answered, "There has never been a prostitute here."
So he went back to Judah and said, "I could not find the woman, and the people who lived there said, 'There has never been a prostitute here.'"
Judah said, "Let her keep the things. I don't want people to laugh at us. I sent her the goat as I promised, but you could not find her."
About three months later someone told Judah, "Tamar, your daughter-in-law, is guilty of acting like a prostitute, and now she is pregnant." Then Judah said, "Bring her out and let her be burned to death."
When the people went to bring Tamar out, she sent a message to her father-in-law that said, "The man who owns these things has made me pregnant. Look at this seal and its cord and this walking stick, and tell me whose they are."
Judah recognized them and said, "She is more in the right than I. She did this because I did not give her to my son Shelah as I promised." And Judah did not have sexual relations with her again.
When the time came for Tamar to give birth, there were twins in her body.
While she was giving birth, one baby put his hand out. The nurse tied a red string on his hand and said, "This baby came out first."
But he pulled his hand back in, so the other baby was born first. The nurse said, "So you are able to break out first," and they named him Perez.
After this, the baby with the red string on his hand was born, and they named him Zerah.