We report the fabrication and characterization of AlxGa1−xN p-i-n photodiodes (0 ⩽ x ⩽ 0.15) grown on sapphire by low-pressure metalorganic chemical vapor deposition. The devices present a visible rejection of six orders of magnitude with a cutoff wavelength that shifts from 365 to 338 nm. Photocurrent decays are exponential for high load resistances, with a time constant that corresponds to the RC product of the system. For low load resistances, the transient response becomes non-exponential, with a decay time longer than the RC constant. This behavior is justified by the strong frequency dependence of the device capacitance. By an admittance analysis, we conclude that speed is not limited by deep levels, but by substitutional Mg capture and emission time. © 1999 American Institute of Physics.