There are two ways in which an animal can confine its behavior to a nocturnal or diurnal niche. One is to synchronize an endogenous clock that in turn controls the sleep-wake cycle. The other is to respond directly to illumination with changes in activity. In mice, high illumination levels suppress locomotion (negative masking) and low illumination levels enhance locomotion (positive masking). To investigate the role of the newly discovered opsin-like protein melanopsin in masking, we used 1 h and 3 h pulses of light given in the night, and also a 3.5:3.5 h light-dark (LD) cycle. Mice lacking the melanopsin gene had normal enhancement of locomotion in the presence of dim lights but an impaired suppression of locomotion in the presence of bright light. This impairment was evident only with lights in the order of 10 lux or brighter. This suggests that melanopsin in retinal ganglion cells is involved in masking, as it is in pupil contraction and phase shifts. Melanopsin is especially important in maintaining masking responses over long periods.