Let Gamma be an irreducible lattice in a product of n infinite irreducible complete Kac–Moody groups of simply laced type over finite fields. We show that if n>2, then each Kac–Moody groups is in fact a simple algebraic group over a local field and Gamma is an arithmetic lattice. This relies on the following alternative which is satisfied by any irreducible lattice provided n>1: either Gamma is an S-arithmetic (hence linear) group, or it is not residually finite. In that case, it is even virtually simple when the ground field is large enough. More general CAT(0) groups are also considered throughout.