Castling is only allowed when the king nor the castling rook has moved already , when no squares between them are occupied , when the king is not in check , and when the king will not move across or end its movement on a square that puts the king in check .
Castling is allowed only when neither the king nor the castling rook has previously moved , when no squares between them are occupied , when the king is not in check , and when the king will not move across or end its movement on a square that is under enemy control .