Meanwhile, in Egypt, the Midianites had sold Joseph to Potiphar, one of the king's officers, who was the captain of the palace guard.