A fuel cell system, comprising: a fuel cell which receives fuel gas through a pipe; a housing which accommodates the fuel cell; a ventilation fan which is installed in the housing and expels air inside the housing to outside the housing; a first detection unit which detects operation of the ventilation fan; a relay circuit unit which receives input of a detection signal from the first detection unit; and a shut-off valve which is provided in the pipe and is connected to the relay circuit unit, wherein the relay circuit unit closes the shut-off valve when the detection signal from the first detection unit indicates that the number of revolutions of the ventilation fan has become equal to or lower than a reference value, wherein the first detection unit is an optical sensor comprising a light-emitting unit and a light-receiving unit, and when light is emitted from the light-emitting unit and light having passed between blades of the rotating ventilation fan is received by the light-receiving unit, the detection signal is output to the relay circuit unit, and the relay circuit unit calculates a speed of rotation of the fan, on the basis of the detection signal, and wherein the optical sensor is provided in plurality, and the optical sensors are disposed at positions such that, when light emission by the light-emitting unit in any one of a plurality of sets of light-emitting units and light-receiving units is detected by the light-receiving unit, the light from the light-emitting units of the other sets is shielded by the blades of the fan and is not detected by the light-receiving unit, and the relay circuit unit closes the shut-off valve when the detection signal from any of the optical sensors indicates that the number of revolutions of the ventilation fan has become equal to or lower than the reference value. a fuel cell which receives fuel gas through a pipe; a housing which accommodates the fuel cell; a ventilation fan which is installed in the housing and expels air inside the housing to outside the housing; a first detection unit which detects operation of the ventilation fan; a relay circuit unit which receives input of a detection signal from the first detection unit; and a shut-off valve which is provided in the pipe and is connected to the relay circuit unit, wherein the relay circuit unit closes the shut-off valve when the detection signal from the first detection unit indicates that the number of revolutions of the ventilation fan has become equal to or lower than a reference value, wherein the first detection unit is an optical sensor comprising a light-emitting unit and a light-receiving unit, and when light is emitted from the light-emitting unit and light having passed between blades of the rotating ventilation fan is received by the light-receiving unit, the detection signal is output to the relay circuit unit, and the relay circuit unit calculates a speed of rotation of the fan, on the basis of the detection signal, and wherein the optical sensor is provided in plurality, and the optical sensors are disposed at positions such that, when light emission by the light-emitting unit in any one of a plurality of sets of light-emitting units and light-receiving units is detected by the light-receiving unit, the light from the light-emitting units of the other sets is shielded by the blades of the fan and is not detected by the light-receiving unit, and the relay circuit unit closes the shut-off valve when the detection signal from any of the optical sensors indicates that the number of revolutions of the ventilation fan has become equal to or lower than the reference value.