The Midianite traders later sold Joseph in Egypt. They sold him to Potiphar, an officer of the king of Egypt and the captain of his palace guards.