Constraints from functional magnetic resonance imaging ( fMRI) were used to identify the sources of the visual P300 event-related potential (ERP). Healthy subjects performed a visual three-stimulus oddball paradigm with a difficult discrimination task while fMRI and high-density ERP data were acquired in separate sessions. This paradigm allowed us to differentiate the P3b component of the P300, which has been implicated in the detection of rare events in general (target and distractor), from the P3a component, which is mainly evoked by distractor events. The fMRI-constrained source model explained >99% of the variance of the scalp ERP for both components. The P3b was mainly produced by parietal and inferior temporal areas, whereas frontal areas and the insula contributed mainly to the P3a. This source model reveals that both higher visual and supramodal association areas contribute to the visual P3b and that the P3a has a strong frontal contribution, which is compatible with its more anterior distribution on the scalp. The results point to the involvement of distinct attentional subsystems in target and distractor processing.