The functional magnetic resonance imaging (fMRI) technique was used to investigate the functional neuroanatomy of the attention mechanisms employed in visual search with homogeneous or heterogeneous displays. Participants were asked to search for a vertically oriented bar among distractor bars with the same or different orientations, with half of the trials being target-present and the other half being target-absent. Behaviorally, RTs were slower for target-absent than for -present trials when the distractors were heterogeneous, but were faster for target-absent than for -present trials when the distractors were homogeneous. At the neural level, a widely distributed brain network was involved in this interaction. The bilateral frontal eye field, intraparietal sulcus, precentral gyrus and supplementary eye field may play a role in representing the target against distractors and further in detecting and responding to the presence of the target. The right superior frontal gyrus and the bilateral temporal–parietal junction may play a role in filtering distracting information in the search process.