illegal moves


The King cannot move into an attacked square (and thus put itself in check). It is illegal - meaning that it is not allowed at all when playing chess. All other pieces can move into an attacked square unless it would allow the king to be attacked (put in check).
In the example below, White cannot move his king to g1, g2, or g3 because it is under attack. Also, the White knight cannot move because that would allow the king to be attacked.