BAGHDAD, Iraq — If the gunmen who carried out a mass killing Saturday night escape punishment it will be not only because the victims were prostitutes, all too often friendless and forgotten, but also because the government needs to keep the murderers on its side.

Officially, Iraq’s Ministry of the Interior...