Under certain circumstances, action potentials can be initiated in the distal axon, but how the back-propagation of this activity to the soma is prevented is unknown. In this study, pharmacologically induced gamma oscillations in mouse hippocampal slices produced ectopic action potentials in distal axons of CA3 pyramidal cells. Back-propagation of these spikes to the soma was reduced by GABA release from axo-axonic cells at the axon initial segment during fast oscillations, thus enabling functional compartmentalization of axonal and somatic activity.