Combined electron beam induced current and transmission electron microscopy ͑TEM͒ measurements have been performed on both undoped and Si-doped AlGaN epitaxial films with aluminum contents x ranging from xϭ0 to xϭ0.79, in order to correlate the electrical and structural properties of the films. The diffusion length of holes in the films ranges between 0.3 and 15.9 m, and the estimated lifetime of holes for doped samples varies between 0.2 ns and 16 s. Different effects contribute to the observed increase in the diffusion length with increasing aluminum content. Among others, dislocations seem to be active as nonradiative recombination sites, and phase separation and decomposition as observed by TEM in Al-rich alloys lead to the formation of a spatially indirect recombination path due to the piezoelectric field in the films. Potential fluctuations associated with these phase irregularities could also give rise to electron induced persistent conductivity contributing to the increase of the diffusion length. From our experimental observations, we conclude that the silicon dopants are partially activated in Al-rich alloys, and do not influence significantly the values of the diffusion length of holes in these samples.