That pluses some other conventions and protocols are collectively called Geneva Conventions.
As for invasion, basically every nations/tribes have been invaders once upon the history. There is no way to stop invasion, however, the conventions give a lavage that the losing side who violates these conventions will be persecuted for war crime.