While several in vitro experiments on viral genome release have specifically studied the effects of external osmotic pressure and of the presence of polyvalent cations on the ejection of DNA from bacteriophages, few have systematically investigated how the extent of ejection is controlled by a combination of these effects. In this work we quantify the effect of osmotic pressure on the extent of DNA ejection from bacteriophage lambda as a function of polyvalent cation concentration (in particular, the tetravalent polyamine spermine). We find that the pressure required to completely inhibit ejection decreases from 38 to 17 atm as the spermine concentration is increased from 0 to 1.5 mM. Further, incubation of the phage particles in spermine concentrations as low as 0.15 mM—the threshold for DNA condensation in bulk solution—is sufficient to significantly limit the extent of ejection in the absence of osmolyte; for spermine concentrations below this threshold, the ejection is complete. In accord with recent investigations on the packaging of DNA in the presence of a condensing agent, we observe that the self-attraction induced by the polyvalent cation affects the ordering of the genome, causing it to get stuck in a broad range of nonequilibrated structures.