Brain activity was studied by fMRI in 18 healthy subjects during stimulation of the thenar eminence of the hand with either warm (non-painful, 40 degrees C) or hot (painful, 46-49 degrees C) stimuli using a contact thermode. Experiments were performed on the right and left hand independently and with two attentional contexts: subjects either attended to pain or attended to a visual global motion discrimination task (to distract them from pain). Group analysis demonstrated that attended warm stimulation of the right hand did not produce any significantly activated clusters. Painful thermal stimulation of either hand elicited significant activity over a large network of brain regions, including insula, inferior frontal gyrus, cingulate gyrus, secondary somatosensory cortex, cerebellum, and medial frontal gyrus (corrected P <0.05). Insula activity was distributed along its anterior-posterior axis and depended on the hand stimulated and attentional context. In particular, activity within the posterior insula was contralateral to the site of stimulation, tested using regions of interest (ROI) analysis: significant side x site interaction (P = 0.001). With attention diverted from the painful stimulus bilateral anterior insula activity moved posteriorly to midinsula and decreased in extent (ROI analysis: significant main effect of attention (P = 0.03)). The role of the insula in thermosensation and attention is discussed.