The present invention relates to a wavelengthswept laser and a method for generating laser output. The wavelengthswept pulse laser according to one aspect of the present invention uses spontaneous modelocking to produce a pulse output with the center wavelength continuously varying with time. On the contrary, the wavelengthswept laser according to another aspect of the present invention suppresses modelocking to produce continuous output by tuning the filter frequency change speed to the frequency shift speed of the frequency shifter. The lasers of the present invention are applicable to optical sensing or WDM optical communication.