We investigated the effect of microstimulation of the superficial layers of the superior colliculus (SC) on the performance of animals in a peripheral detection paradigm while maintaining fixation. In a matching-to-sample paradigm, a sample stimulus was presented at one location followed by a brief test stimulus at that (relevant) location and a distractor at another (irrelevant) location. While maintaining fixation, the monkey indicated whether the sample and the test stimulus matched, ignoring the distractor. The relevant and irrelevant locations were switched from trial to trial. Cells in the superficial layers of SC gave enhanced responses when the attended test stimulus was inside the receptive field compared with when the (physically identical) distractor was inside the field. These effects were found only in an “automatic” attentional cueing paradigm, in which a peripheral stimulus explicitly cued the animal as to the relevant location in the receptive field. No attentional effects were found with block of trials. The transient enhancement to the attended stimulus was observed at the onset and not at the offset of the stimulus. Electrical stimulation at the site corresponding to the irrelevant distractor location in the SC causes it to gain control over attention, causing impaired performance of the task at the relevant location. Stimulation at unattended sites without the presence of a distractor stimulus causes little or no impairment in performance. The effect of stimulation decays with successive stimulations. The animals learn to ignore the stimulation unless the parameters of the task are varied.