Castling Out of Check
If your King is in check, you cannot castle. It is just the rule, and it’s great for attacking. If you want to avoid the King running away, check it. And then if the King moves even one square to avoid the check, then it has permanently lost the “castling right”.
Note that checking a King does not permanently lose the castling right if the King doesn’t move. If some other piece blocks the check, or the checking piece gets captured by some other piece, then the King still has the “right to castle” and may castle later. Check only prevents check for the current move, but moving the King loses the castling right permanently.
Related Chess Rules Topics
Read more about these related chess rules, chess puzzles, and other chess tactics and strategies: