We develop the theory explaining the role of nonlinearity in generation of radiation in a fiber laser that is pumped by external light. The pumping energy is converted into the generating signal due to the Raman scattering supplying an effective gain for the signal. The signal is generated with frequencies near the one corresponding to the maximum value of the gain. Generation conditions and spectral properties of the generated signal are examined. We focus mainly on the case of a random laser where reflection of the signal occurs on impurities of the fiber. From the theoretical standpoint, kinetics of a wave system close to an integrable one are investigated. We demonstrate that in this case, the perturbation expansion in the kinetic equation has to use the closeness to the integrable case.