Method for detecting the presence of a body part bearing a fingerprint (D) on a fingerprint sensor comprising a transparent face on which a body part (D) is to be placed, an image sensor , located opposite the transparent face , able to acquire an image of a fingerprint, a light source for illuminating a body part placed on the transparent face , the method comprising: turning on the light source; obtaining a multicomponent image from the image sensor, each colour component of the multicomponent image corresponding to a predefined wavelength range, the fingerprint sensor operating in accordance with a dark-background total internal reflection principle, the light source producing light the wavelengths of which are contained exclusively within one of the predefined wavelength ranges, referred to as illumination wavelength range; forming a single-component image from each component of the multicomponent image, determining a representative value for each single-component image, comprising: computing, for each pixel of the single-component image, a local dynamic value in the form of an average of the values of the pixels located within a vicinity around said pixel, computing an average of the local dynamic values of the entire single-component image so as to obtain an overall dynamic value for the single-component image, the overall dynamic value for the single-component image forming said representative value for each single-component image; comparing the representative values for each component with one another, detecting the presence of a body part when a deviation between the representative value determined for the colour component corresponding to the illumination wavelength range and the other representative values is greater than a first predetermined threshold. turning on the light source; obtaining a multicomponent image from the image sensor, each colour component of the multicomponent image corresponding to a predefined wavelength range, the fingerprint sensor operating in accordance with a dark-background total internal reflection principle, the light source producing light the wavelengths of which are contained exclusively within one of the predefined wavelength ranges, referred to as illumination wavelength range; forming a single-component image from each component of the multicomponent image, determining a representative value for each single-component image, comprising: computing, for each pixel of the single-component image, a local dynamic value in the form of an average of the values of the pixels located within a vicinity around said pixel, computing an average of the local dynamic values of the entire single-component image so as to obtain an overall dynamic value for the single-component image, the overall dynamic value for the single-component image forming said representative value for each single-component image; computing, for each pixel of the single-component image, a local dynamic value in the form of an average of the values of the pixels located within a vicinity around said pixel, computing an average of the local dynamic values of the entire single-component image so as to obtain an overall dynamic value for the single-component image, the overall dynamic value for the single-component image forming said representative value for each single-component image; comparing the representative values for each component with one another, detecting the presence of a body part when a deviation between the representative value determined for the colour component corresponding to the illumination wavelength range and the other representative values is greater than a first predetermined threshold. <EOS>