On the origin of high-energy cosmic neutrinos