RECENT observations of faint galaxies at near-infrared wavelengths 1-3 reveal a surprisingly low surface density when compared to the excess of blue galaxies seen at optical wavelengths 4. Attempts to determine the cosmological curvature from the asymptotic surface density of faint galaxies thus produce conflicting results 3, 5-7. We propose to resolve this conflict with an evolutionary model in which galaxies merge at recent look-back times. The contrast between optical and infrared galaxy counts then follows from the very different lifetimes of stellar types contributing to emission in the galactic rest-frame. Together with evidence we present an increased star formation rate in galaxies at moderate redshift, the merging model can account for both the number-magnitude relations and available redshift distributions. A clear prediction is that there should be an absence of high-redshift galaxies in deep infrared-selected surveys. If correct, the model confirms earlier suspicions that galaxies cannot be used as reliable tracers of the geometry of the Universe.