Now the Midianites had sold him in Egypt to Potiphar, an officer of Pharaoh and captain of the guard.