The objective of the game of chess is to checkmate the opponent’s king.
When the king is attacked by an enemy pawn of piece it is said to be under check.
When a king is under check, it should be either moved away or the attacking piece should be captured or the king should be shielded from the attack by blocking the path of the check.
This has to be done in the next move itself because a king cannot be left ‘on check’ anytime. If a player leaves his king ‘on check’ and makes some other move, that move is illegal and according to Laws of Chess Article 7 (The touched piece) and Article 7.4 (Illegal position) that move should be retracted and another move made. Therefore any check on the king must be parried immediately in the next move. If a check cannot be parried, the king is said to be checkmated, or mated. And the game ends immediately in victory for the player making the check.