Competition between radiative recombination and nuclear excitation by electron capture