It is not only an Italian law. It is a principle of international law.o, but they represent the italian interests abroad and by our law they are covered by immunity. Which does not mean they cannot be trialed, but only by an italian military court.
MIlitaries in the execution of their duties "are their Country". Substantially it is the same thing as the ambassadors. Their personal responsability comes at stake only about what are considered to be "crimes against humanity"