Context. The bulk of solar flare emission originates from very compact sources located in the lower solar atmosphere and observable at a broad range of wavelengths such as near optical, UV, EUV, soft and hard X-rays, and gamma-rays. Nevertheless, very few spatially resolved imaging observations have been performed to determine the structure of these compact regions. Aims. We investigate the above-the-photosphere heights of hard X-ray (HXR), EUV, and white-light (6173 Å) continuum sources in the low atmosphere and the corresponding densities at these heights. By considering the collisional transport of solar energetic electrons, we also determine where and how much energy is deposited and compare these values with the emissions observed in HXR, EUV, and the continuum. Methods. Simultaneous EUV/continuum images from AIA/HMI on-board SDO and HXR RHESSI images are compared to study a well-observed gamma-ray limb flare. Using RHESSI X-ray visibilities, we determine the height of the HXR sources as a function of energy above the photosphere. Co-aligning AIA/SDO and HMI/SDO images with RHESSI, we infer, for the first time, the heights and characteristic densities of HXR, EUV, and continuum (white-light) sources in the flaring footpoint of the magnetic loop. Results. We find 35-100 keV HXR sources at heights of between 1.7 and 0.8 Mm above the photosphere, below the 6173 Å continuum emission that appears at heights 1.5−3 Mm and the peak of EUV emission originating near 3 Mm. Conclusions. The EUV emission locations are consistent with energy deposition from low energy electrons of ∼12 keV occurring in the top layers of the fully ionized chromosphere/low corona and not by 20 keV electrons that produce HXR footpoints in the lower neutral chromosphere. The maximum of white-light continuum emission appears between the HXR and EUV emission, presumably in the transition between ionized and neutral atmospheres, implying that it consists of free-bound and free-free continuum emission. We note that the energy deposited by low energy electrons is sufficient to explain the energetics of both the optical and UV emissions.