Britannica Sources used in this answer

Why is castling illegal when the king passes through an attacked square?

Created from Britannica articles using AI. AI can make mistakes, so verify using Britannica articles.

In chess, castling is a special move involving both the king and the rook. While it is a powerful defensive maneuver, the rules strictly prohibit it under certain conditions to maintain the integrity of the game's safety mechanics.

Specifically, castling is illegal if the king is currently in check, if it would land in check, or if it must pass through a square that is under attack by an enemy piece. This rule exists because the king is never permitted to move into a position where it could be captured, and the path of the king during castling is treated as an extension of this protective principle. By preventing the king from crossing an attacked square, the game ensures that the king cannot bypass a threat to reach a safer position, upholding the fundamental objective of protecting the king at all times.1