Answers.Body: <p>The way I always understood castling is that it allows the player to move his king to safety. But this privilege does not come for free - it comes at the cost of a tempo. If a player was allowed to castle out of check, or over a checked square, then it allows him to postpone this powerful move until the very latest, effectively removing the penalty from the privilege.</p>
  
  <p>For me, this rule has nothing to do with how the king (or any other pieces) move. It has to do with achieving a balance between attacking play and defensive play. Just like how a goal keeper in football can handle the ball in his penalty area (but not if it was back-passed to him by one of his own players), so the rule of castling is there to ensure that you get a defensive edge, but not for free. You have to work it into your strategy.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-01-06T23:20:57.057Z
Answers.Text: +1. I agree, there's a certain sense of ant/grasshopper justice to not allowing a king to wait until checked to castle.
Answers.UserDisplayName: ETD
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-01-06T13:57:11.557Z
Answers.LastActivityDate: 2014-01-07T07:44:07.780Z
Answers.LastEditDate: 2014-01-07T07:44:07.780Z
Answers.UserDisplayName: firtydank
Answers.Body: <p>I just posted an answer to this question <a href="https://chess.stackexchange.com/questions/486/how-did-castling-originate">How did castling originate?</a> and I think it offers a missing part of the answer to this questions as well: What the rationale is, behind not being able to castle out of check.</p>
  
  <p>Historically castling was probably two moves (the rook move and the king's leap), that were merged into a double move, because they basically always followed directly one after the other. Just like the double move of the pawns.</p>
  
  <p>And just like you cannot escape capture from an enemy pawn, by just moving past it, you cannot escape check by just castling: In both cases the "double move" is dissected into the two original moves - the pawn can be taken en passant and the king could still be taken after the rook move, making castling illegal.</p>
  
  <p>In both cases the rationale is speeding up the game, without changing what was possible before.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-14T12:25:40.893Z
Answers.Text: interesting. so historically the rook move had to come first, then the king jumped over it.
Answers.UserDisplayName: peter
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-12-02T06:38:20.330Z
Answers.Text: This is indeed interesting. But when they changed the rule into a single move, they could also have taken out the check restriction (and a 2-spaces forward moving pawn can block a king check, if that is relevant to the argument in the answer).
Answers.UserDisplayName: Déjà vu
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-02-09T13:57:09.433Z
Answers.LastActivityDate: 2015-02-09T13:57:09.433Z
Answers.LastEditDate: 2017-04-13T12:48:53.737Z
Answers.UserDisplayName: BlindKungFuMaster
Answers.Body: <p>Because that would be cheating.  Well, to be fair, the reason is to make it reasonable that when <em>all of the squares surrounding a king and the square it stands on are attacked by the opponent</em>, the defender cannot simply <em>warp</em> away and out of trouble, while simultaneously delivering a new defender in the fray.  The move would simply be too powerful.</p>
  
  <p>However, you <em>are</em> allowed to do this:</p>
  
  <pre><code>[FEN "1r6/p2nkp1p/2B1pb1B/2p5/6r1/2P5/PP3P1P/R3K2R w KQ - 0 21"]
  [Event "Todd Southam Memorial"]
  [Site "Toronto"]
  [Date "2004.06.13"]
  [White "Krupnov, Maxim E"]
  [Black "Smith, Hazel"]
  [Result "1-0"]
  [WhiteElo "2361"]
  [BlackElo "2051"]
  [SetUp "1"]
  [EventType "schev (rapid)"]
  
  1. Be3 Rxb2 2. Bxd7 Kxd7 3. O-O-O+ Kc6 4. Kxb2 {and White won in 42 moves} 1-0
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-05-25T13:33:44.517Z
Answers.Text: Don't understand why this was downvoted. The point is valid. If the king is in check along with all its surrounding squares, that would be checkmate (unless there's a blocking move). You should not be able to warp out of checkmate.
Answers.UserDisplayName: DrZ214
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-10T01:52:04.940Z
Answers.LastActivityDate: 2016-10-10T01:52:04.940Z
Answers.UserDisplayName: jaxter
Answers.Body: <p>One rationale that I can think of for not allowing the king to move through check parallels that behind the possibility of capturing <a href="http://en.wikipedia.org/wiki/En_passant">en passant</a> after a pawn makes a two-square advance.</p>
  
  <ul>
  <li><p>The typical pawn move is just a single square forward, and the possibility of advancing two squares on a pawn's first move was a <a href="http://en.wikipedia.org/wiki/En_passant#Historical_context"><em>relatively late addition to the game</em></a> in historical terms. Since the "nature" of a pawn had long been to make a single square advance, when that new sort of pawn move came into being, the en passant capture was a natural counterpart: the pawn doesn't "jump" two squares ahead, but rather "marches" through the intermediate square, and an opposing pawn is thus allowed to capture en passant on the following move if it is in position to have captured the advancing pawn at the intermediate square.</p></li>
  <li><p>With that explanation in mind, let's consider your rule. Like pawns, a king's typical, natural movement is only a single square in distance. And like the pawn's two-square advance, castling is a <em>relatively new addition to the rules</em> of chess that is intended to speed the game up. So just as the en passant capture reinforces the pawn's nature as a one-square mover, the rule prohibiting a king to castle through a checked square reinforces the king's nature as a one-square mover. He is thought of not as gliding over the checked square, but rather trudging through it. And just as an opponent's pawn has a chance to capture en passant, an opponent's piece guarding the intermediate castling square would be given the right to capture the king. Since that's not a legal part of chess, castling through check in the first place isn't either.</p></li>
  </ul>
  
  <p>As for why castling is disallowed just because of the king being in check, I'm not so sure, but I'll speculate. If, in the analogy between chess and war, we think of a check to the king as a wounding attack, less severe than the lethal checkmate but damaging nonetheless, then it's reasonable to insist that the hobbled king can't make a swift, immediate escape via castling. But maybe that's just how I think of it.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-01-05T18:46:43.837Z
Answers.Text: The pawn's two square advance/king's two square leap makes sense, but what about the placement of the rook? Is the rook assumed to be able to jump over or teleport next to the king?
Answers.UserDisplayName: Alexandros
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-01-06T17:41:11.960Z
Answers.Text: Good answer.  To elaborate on the castling rule evolution, when castling first was introduced, it happened over two moves.  The first move was moving the king, and then the second move was moving the rook to the other side of the king.  I think this is part of the reason that castling still follows so many of the rules regarding check and legality.
Answers.UserDisplayName: Andrew
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-25T12:26:45.870Z
Answers.Text: @Alexandros same idea as ETD suggested, jumping two or three squares is part of the rook's natural moves, hence it makes sense that the rook being or passing under attack doesn't interfere with castling. Say white wants to castle Queen-side, if d1 is under attack, the king cannot reach to c1 via d1, but if b1 is under attack, the rook can still easily reach d1 with one move, which means it doesn't gain additional capabilities of jumping over attacked squares the same way as the king would.
Answers.UserDisplayName: downhand
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-14T12:12:00.647Z
Answers.Text: i always assumed that castling out of check is prohibited as to not overpower the castling move. it already is a big advantage over just moving the king one square, it should at least not be able to bring the king from an ongoing attack to complete safety.
Answers.UserDisplayName: peter
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-14T12:17:19.357Z
Answers.Text: also castling was invented to speed up the game. allowing the king to evade check this way would probably prolong most games.
Answers.UserDisplayName: peter
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-14T12:19:12.540Z
Answers.Text: i also just realized that this question would not appear if the rook were to move first. maybe you have to imagine castling on a real battlefield as the king standing around while a shelter is contructed for him, the rook is used in this construction and then he slides in. he cannot wait for that while under attack.
Answers.UserDisplayName: peter
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-13T12:21:09.020Z
Answers.Text: AFAIK, castling was invented to provide protection to the king against the new queen, which was too powerful. At first castling took two moves, first by the rook and then the king would 'jump' through the rook to its castle. It was not so strange because other pieces like the old 'alferza' could do a 'salto de la alegría' jumping some squares under some conditions (the 'alferza' just after being promoted from a pawn)
Answers.UserDisplayName: sharcashmo
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-14T13:21:46.770Z
Answers.Text: Brilliant ending!
Answers.UserDisplayName: Jossie Calderon
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-25T21:59:45.657Z
Answers.Text: It's strange to think that chess has evolved so much in the past, yet, in the present day, changes to its fundamental rules would be unthinkable.
Answers.UserDisplayName: konsolas
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-01-05T02:38:35.257Z
Answers.LastActivityDate: 2014-01-05T03:06:12.677Z
Answers.LastEditDate: 2014-01-05T03:06:12.677Z
Answers.UserDisplayName: ETD
Body: <p>Why is castling disallowed when the king is in check or when the square the rook will be placed on is under attack?</p>
  
  <p>What is the rationale behind this ruling?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-01-05T18:34:52.433Z
Comments.Text: When castling, the King is thought of as moving 2 squares, not teleporting 2 squares. Since the King may not move into check, castling through a square controlled by the opponent constitutes moving into check.
Comments.UserDisplayName: Tony Ennis
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-03-25T12:42:54.287Z
Comments.Text: @HarjinderSingh No, that is prohibited, as the question remarks.
Comments.UserDisplayName: Daniel
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-03-16T14:58:41.460Z
Comments.Text: Not necessary every rule should have logical and rational reason behind... this is a rule of this game.
Comments.UserDisplayName: Jackal
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-12-02T07:00:10.670Z
Comments.Text: @Jackal Sure, but usually they have logical, or at least historical (based on logic) reasons.
Comments.UserDisplayName: Déjà vu
Tags: <rules><castling><illegal-move>
Title: Why is castling through and out of check prohibited?
ThreadText: # Why is castling through and out of check prohibited?
  
  (Asked by: username_0 on 2014-01-04)
  
  Why is castling disallowed when the king is in check or when the square the rook will be placed on is under attack?
  
  What is the rationale behind this ruling?
  
  **Tags:** rules, castling, illegal-move
  
  > **Comments:**
  > **username_1**: When castling, the King is thought of as moving 2 squares, not teleporting 2 squares. Since the King may not move into check, castling through a square controlled by the opponent constitutes moving into check.  
  > **username_2**: @HarjinderSingh No, that is prohibited, as the question remarks.  
  > **username_3**: Not necessary every rule should have logical and rational reason behind... this is a rule of this game.  
  > **username_4**: @username_3 Sure, but usually they have logical, or at least historical (based on logic) reasons.  
  
  ---
  
  ## 4 answers
  
  ### Answer by username_6 on 2014-01-05. Score: 24 | Accepted answer
  
  One rationale that I can think of for not allowing the king to move through check parallels that behind the possibility of capturing [en passant](http://en.wikipedia.org/wiki/En_passant) after a pawn makes a two-square advance.
  
  * The typical pawn move is just a single square forward, and the possibility of advancing two squares on a pawn's first move was a [*relatively late addition to the game*](http://en.wikipedia.org/wiki/En_passant#Historical_context) in historical terms. Since the "nature" of a pawn had long been to make a single square advance, when that new sort of pawn move came into being, the en passant capture was a natural counterpart: the pawn doesn't "jump" two squares ahead, but rather "marches" through the intermediate square, and an opposing pawn is thus allowed to capture en passant on the following move if it is in position to have captured the advancing pawn at the intermediate square.
  * With that explanation in mind, let's consider your rule. Like pawns, a king's typical, natural movement is only a single square in distance. And like the pawn's two-square advance, castling is a *relatively new addition to the rules* of chess that is intended to speed the game up. So just as the en passant capture reinforces the pawn's nature as a one-square mover, the rule prohibiting a king to castle through a checked square reinforces the king's nature as a one-square mover. He is thought of not as gliding over the checked square, but rather trudging through it. And just as an opponent's pawn has a chance to capture en passant, an opponent's piece guarding the intermediate castling square would be given the right to capture the king. Since that's not a legal part of chess, castling through check in the first place isn't either.
  
  As for why castling is disallowed just because of the king being in check, I'm not so sure, but I'll speculate. If, in the analogy between chess and war, we think of a check to the king as a wounding attack, less severe than the lethal checkmate but damaging nonetheless, then it's reasonable to insist that the hobbled king can't make a swift, immediate escape via castling. But maybe that's just how I think of it.
  
  > **Comments:**
  > **username_0**: The pawn's two square advance/king's two square leap makes sense, but what about the placement of the rook? Is the rook assumed to be able to jump over or teleport next to the king?  
  > **username_11**: Good answer.  To elaborate on the castling rule evolution, when castling first was introduced, it happened over two moves.  The first move was moving the king, and then the second move was moving the rook to the other side of the king.  I think this is part of the reason that castling still follows so many of the rules regarding check and legality.  
  > **username_12**: @username_0 same idea as ETD suggested, jumping two or three squares is part of the rook's natural moves, hence it makes sense that the rook being or passing under attack doesn't interfere with castling. Say white wants to castle Queen-side, if d1 is under attack, the king cannot reach to c1 via d1, but if b1 is under attack, the rook can still easily reach d1 with one move, which means it doesn't gain additional capabilities of jumping over attacked squares the same way as the king would.  
  > **username_8**: i always assumed that castling out of check is prohibited as to not overpower the castling move. it already is a big advantage over just moving the king one square, it should at least not be able to bring the king from an ongoing attack to complete safety.  
  > **username_8**: also castling was invented to speed up the game. allowing the king to evade check this way would probably prolong most games.  
  > **username_8**: i also just realized that this question would not appear if the rook were to move first. maybe you have to imagine castling on a real battlefield as the king standing around while a shelter is contructed for him, the rook is used in this construction and then he slides in. he cannot wait for that while under attack.  
  > **username_13**: AFAIK, castling was invented to provide protection to the king against the new queen, which was too powerful. At first castling took two moves, first by the rook and then the king would 'jump' through the rook to its castle. It was not so strange because other pieces like the old 'alferza' could do a 'salto de la alegría' jumping some squares under some conditions (the 'alferza' just after being promoted from a pawn)  
  > **username_14**: Brilliant ending!  
  > **username_15**: It's strange to think that chess has evolved so much in the past, yet, in the present day, changes to its fundamental rules would be unthinkable.  
  
  ---
  
  ### Answer by username_5 on 2014-01-06. Score: 17
  
  The way I always understood castling is that it allows the player to move his king to safety. But this privilege does not come for free - it comes at the cost of a tempo. If a player was allowed to castle out of check, or over a checked square, then it allows him to postpone this powerful move until the very latest, effectively removing the penalty from the privilege.
  
  For me, this rule has nothing to do with how the king (or any other pieces) move. It has to do with achieving a balance between attacking play and defensive play. Just like how a goal keeper in football can handle the ball in his penalty area (but not if it was back-passed to him by one of his own players), so the rule of castling is there to ensure that you get a defensive edge, but not for free. You have to work it into your strategy.
  
  > **Comments:**
  > **username_6**: +1. I agree, there's a certain sense of ant/grasshopper justice to not allowing a king to wait until checked to castle.  
  
  ---
  
  ### Answer by username_7 on 2015-02-09. Score: 10
  
  I just posted an answer to this question [How did castling originate?](https://chess.stackexchange.com/questions/486/how-did-castling-originate) and I think it offers a missing part of the answer to this questions as well: What the rationale is, behind not being able to castle out of check.
  
  Historically castling was probably two moves (the rook move and the king's leap), that were merged into a double move, because they basically always followed directly one after the other. Just like the double move of the pawns.
  
  And just like you cannot escape capture from an enemy pawn, by just moving past it, you cannot escape check by just castling: In both cases the "double move" is dissected into the two original moves - the pawn can be taken en passant and the king could still be taken after the rook move, making castling illegal.
  
  In both cases the rationale is speeding up the game, without changing what was possible before.
  
  > **Comments:**
  > **username_8**: interesting. so historically the rook move had to come first, then the king jumped over it.  
  > **username_4**: This is indeed interesting. But when they changed the rule into a single move, they could also have taken out the check restriction (and a 2-spaces forward moving pawn can block a king check, if that is relevant to the argument in the answer).  
  
  ---
  
  ### Answer by username_9 on 2016-10-10. Score: 5
  
  Because that would be cheating. Well, to be fair, the reason is to make it reasonable that when *all of the squares surrounding a king and the square it stands on are attacked by the opponent*, the defender cannot simply *warp* away and out of trouble, while simultaneously delivering a new defender in the fray. The move would simply be too powerful.
  
  However, you *are* allowed to do this:
  
  ```
  [FEN "1r6/p2nkp1p/2B1pb1B/2p5/6r1/2P5/PP3P1P/R3K2R w KQ - 0 21"]
  [Event "Todd Southam Memorial"]
  [Site "Toronto"]
  [Date "2004.06.13"]
  [White "Krupnov, Maxim E"]
  [Black "Smith, Hazel"]
  [Result "1-0"]
  [WhiteElo "2361"]
  [BlackElo "2051"]
  [SetUp "1"]
  [EventType "schev (rapid)"]
  
  1. Be3 Rxb2 2. Bxd7 Kxd7 3. O-O-O+ Kc6 4. Kxb2 {and White won in 42 moves} 1-0
  
  ```
  
  > **Comments:**
  > **username_10**: Don't understand why this was downvoted. The point is valid. If the king is in check along with all its surrounding squares, that would be checkmate (unless there's a blocking move). You should not be able to warp out of checkmate.  
  
  ---
  
  