What is the function of dilute HCl in group II analysis?

Due to common ion effect of H+ ions, the degree of dissociation of H2S is suppressed, so the concentration of sulphide ions decreases. Thus the ionic product of sulphides of group II cations (Hg2+, Pb2+, Cu2+, Cd2+, Bi3+) decreases. But this is large enough to exceed the value of their solubility products and radicals of group II get precipitated.
Other groups cations are not precipitated because their Ksp are comparatively higher.