Castling provides a safer haven for the king.