Compact high-efficiency ultraviolet solid-state light sources--such as light-emitting diodes (LEDs) and laser diodes--are of considerable technological interest as alternatives to large, toxic, low-efficiency gas lasers and mercury lamps. Microelectronic fabrication technologies and the environmental sciences both require light sources with shorter emission wavelengths: the former for improved resolution in photolithography and the latter for sensors that can detect minute hazardous particles. In addition, ultraviolet solid-state light sources are also attracting attention for potential applications in high-density optical data storage, biomedical research, water and air purification, and sterilization. Wide-bandgap materials, such as diamond and III-V nitride semiconductors (GaN, AlGaN and AlN; refs 3-10), are potential materials for ultraviolet LEDs and laser diodes, but suffer from difficulties in controlling electrical conduction. Here we report the successful control of both n-type and p-type doping in aluminium nitride (AlN), which has a very wide direct bandgap of 6 eV. This doping strategy allows us to develop an AlN PIN (p-type/intrinsic/n-type) homojunction LED with an emission wavelength of 210 nm, which is the shortest reported to date for any kind of LED. The emission is attributed to an exciton transition, and represents an important step towards achieving exciton-related light-emitting devices as well as replacing gas light sources with solid-state light sources.