In this work we propose a new Bayesian method for the non-invasive localization of EEG sources. For this problem, most of the existing methods assume that the sources are distributed throughout the brain volume according to smooth 3D patterns. However, this assumption might fail in pathological conditions, such as in an epileptic brain, where it can occur that the neurophysiological generators are localized in a narrow region, highly compacted, what originates abrupt profiles of electrical activity. This new method incorporates a Total Variation (TV) prior which has been used before in image processing for edge detection and applies variational methods to approximate the probability distributions to estimate the unknown parameters and the sources. The procedure is tested and validated on synthetic EEG data.