You were angry with the chief baker and me, and you put us in prison in the house of the captain of the guard.
Meanwhile, in Egypt the Midianites had sold Joseph to Potiphar, one of the king's officers, who was the captain of the palace guard.
and had Joseph arrested and put in the prison where the king's prisoners were kept, and there he stayed.