The IceCube (IC) collaboration recently reported the detection of TeV-PeV extraterrestrial neutrinos whose origin is yet unknown. By the photon-neutrino connection in pp and pγ interactions, we use the Fermi-LAT observations to constrain the origin of the IC detected neutrinos. We find that Galactic origins, i.e., the diffuse Galactic neutrinos due to cosmic ray (CR) propagation in the Milky Way, and the neutrinos from the Galactic point sources, may not produce the IC neutrino flux, thus these neutrinos should be of extragalactic origin. Moreover, the extragalactic gamma-ray bursts (GRBs) may not account for the IC neutrino flux, the jets of active galactic nuclei may not produce the IC neutrino spectrum, but the starburst galaxies (SBGs) may be promising sources. As suggested by the consistency between the IC detected neutrino flux and the Waxman-Bahcall bound, GRBs in SBGs may be the sources of both the ultrahigh energy, 10 19 eV, CRs and the 1 − 100 PeV CRs that produce the IC detected TeV-PeV neutrinos.