Around that time Judah left his brothers and stayed near an Adullamite named Hirah. Judah married the daughter of a Canaanite man named Shua, and they had three sons: Er, Onan, and Shelah. Judah found a wife for Er named Tamar, but Er was displeasing to God and died.
After that, Tamar remained in Judah’s family, but things did not go the way Judah expected, and there was a painful, confusing struggle about what would happen next. In time, Judah realized he had been unfair to Tamar, and he admitted it.
Tamar later gave birth to twins, Perez and Zerah.
Meanwhile, Joseph was taken to Egypt. There he was sold to Potiphar, an officer of Pharaoh. Joseph was far from home, and everything around him was new, new language, new rules, and new people. But Joseph kept working hard, and soon he was noticed for being capable and trustworthy.