A probe transmits acoustic waves toward a subject. After transmission of the acoustic waves, the probe receives reflected acoustic waves of the transmitted acoustic waves. Whether the probe is in contact with a subject is judged based on the received reflected acoustic waves. The probe irradiates light toward the subject when it is judged that the probe is in contact with the subject. After the light is irradiated, acoustic waves generated within the subject due to the light being irradiated are received. A photoacoustic image is generated based on the received acoustic waves generated due to the light being irradiated.