Can you castle if your king has been in check?

Can you castle if your king has been in check? You cannot castle if the king has already moved, or if the rook in question has moved. 2. Nor can you castle while in check. However, you can castle with a rook that is under attack at the time, and the rook can pass through an attacked square when castling while the king cannot.

You cannot castle if the king has already moved, or if the rook in question has moved. 2. Nor can you castle while in check. However, you can castle with a rook that is under attack at the time, and the rook can pass through an attacked square when castling while the king cannot.