Ultraviolet light sources, represented by excimer and mercury lamps, are currently used for various applications, including water purification/sterilization, biotechnology, photolithography and surface modification. However, they have the disadvantages of limited portability, low emission efficiency and the presence of harmful constituents. Finding a compact, efficient and environmentally friendly alternative ultraviolet light source is therefore of considerable technological interest. Aluminium-nitride-based semiconductors show promise as materials for this purpose1,2,3,4,5,6,7,8,9,10,11,12,13, but because of difficulties in controlling electronic conductivity, in light-emitting diodes are hampered by low external quantum efficiencies. Here, we use an electron-beam pumping technique, demonstrating an output of 100 mW and a record power efficiency of ∼40% from AlxGa1−xN/AlN quantum wells emitting at ∼240 nm. This achievement is attributed to carrier confinement within the high-quality quantum wells, as well as the appropriate design of sample structures for electron-beam pumping, and may be a milestone in the path to realizing next-generation ultraviolet light sources with great ecological and economic benefits.