Rationale: Long-term users of ecstasy have shown impaired performance on a multitude of cognitive abilities (most notably memory, attention, executive function). Research into the pattern of MDMA effects on executive functions remains fragmented, however. Objectives: To determine more systematically what aspects of executive function are affected by a history of MDMA use, by using a model that divides executive functions into cognitive flexibility, information updating and monitoring, and inhibition of pre-potent responses. Methods: MDMA users and controls who abstained from ecstasy and other substances for at least 2 weeks were tested with a computerized cognitive test battery to assess their abilities on tasks that measure the three submodalities of executive function, and their combined contribution on two more complex executive tasks. Because of sex-differential effects of MDMA reported in the literature, data from males and females were analyzed separately. Results: Male MDMA users performed significantly worse on the tasks that tap on cognitive flexibility and on the combined executive function tasks; no differences were found on the other cognitive tasks. Female users showed no impairments on any of the tasks. Conclusions: The present data suggest that a history of MDMA use selectively impairs executive function. In male users, cognitive flexibility was impaired and increased perseverative behavior was observed. The inability to adjust behavior rapidly and flexibly may have repercussions for daily life activities.