A device comprising an edge-emitting semiconductor laser, said laser having a multi-layered waveguide, and said waveguide comprising at least one layer with an active region that emits light under electrical injection, said waveguide further comprising at least one layer doped with p-type impurity at one side of said one layer with the active region and multiple layers doped with n-type impurity, stacked between the substrate and the said one layer with the active region in the direction perpendicular to the light propagation forming an aperiodic sequence, wherein said waveguide has the fundamental mode localized at the layer containing the active region and expanded to the whole area of said aperiodic sequence, wherein said waveguide has all higher order modes localized at said aperiodic sequence with leakage losses into the substrate larger than that of the fundamental mode, and wherein said waveguide provides a single-mode output radiation with small divergence, wherein said aperiodic sequence comprises: - an aperiodic leakage controlling sequence (13, 14) configured to cause leakage losses for higher order modes of the emitted light, and - an aperiodic mode expansion sequence (11, 12) configured to expand the fundamental mode of the emitted light, - wherein said aperiodic leakage controlling sequence (13, 14) comprises layers of alternating refractive indices, said layers having either a first refractive index or a second refractive index, the first refractive index being larger than the second refractive index, - wherein said aperiodic mode expansion sequence (11, 12) comprises layers of alternating refractive indices, said layers having either a third refractive index or a fourth refractive index, the third refractive index being larger than the fourth refractive index, and - wherein the aperiodic mode expansion sequence is located between the active region and the aperiodic leakage controlling sequence, - wherein the fourth refractive index is smaller than the second refractive index, - wherein the second refractive index is smaller than the third refractive index, and wherein the third refractive index is smaller than the first refractive index. said laser having a multi-layered waveguide, and said waveguide comprising at least one layer with an active region that emits light under electrical injection, - an aperiodic leakage controlling sequence (13, 14) configured to cause leakage losses for higher order modes of the emitted light, and - an aperiodic mode expansion sequence (11, 12) configured to expand the fundamental mode of the emitted light, - wherein said aperiodic leakage controlling sequence (13, 14) comprises layers of alternating refractive indices, said layers having either a first refractive index or a second refractive index, the first refractive index being larger than the second refractive index, - wherein said aperiodic mode expansion sequence (11, 12) comprises layers of alternating refractive indices, said layers having either a third refractive index or a fourth refractive index, the third refractive index being larger than the fourth refractive index, and - wherein the aperiodic mode expansion sequence is located between the active region and the aperiodic leakage controlling sequence, - wherein the fourth refractive index is smaller than the second refractive index, - wherein the second refractive index is smaller than the third refractive index, and wherein the third refractive index is smaller than the first refractive index.