Merging instability in groups of galaxies with dark matter