The semiclassical equations which describe lasing in nanowires are derived from first principles. Both the lasing threshold condition and the steady-state regime of operation are discussed. It is shown that the lasing is governed by the Fourier coefficients of the field susceptibility averaged over the nanowire cross section. The general theory is illustrated by the case where a nanowire supports a single Fabry-Pérot mode originated from a transverse magnetic waveguide mode. Basing on the developed theory, the possibility of lasing without inversion is predicted and the corresponding nanolaser cavity is designed.