A rotating electric machine comprising: a rotor configured to be fixed to an end portion of a rotation shaft part of an engine, the rotor being in the shape of a tube with a bottom; a stator arranged inside the rotor; and a magnetic sensor unit configured to detect a rotational position of the rotor, the stator including a plurality of teeth that extend in a radial direction of the rotation shaft part, the plurality of teeth being arranged in a circumferential direction of the rotation shaft part, the rotor including a bottom wall portion having a disk-like shape, a peripheral wall portion having a tubular shape, and a permanent magnet, the bottom wall portion being fixed to the rotation shaft part, the peripheral wall portion extending in an axial direction of the rotation shaft part from an outer circumferential edge of the bottom wall portion toward the engine, the permanent magnet being fixed to an inner circumferential surface of the peripheral wall portion, the magnetic sensor unit including a case main body and a magnetic sensor element that is incorporated in the case main body, characterised by the permanent magnet including an extension portion that extends in the axial direction toward the engine beyond an end surface at an engine side of the teeth, the magnetic sensor element being arranged closer to the engine than an end surface at the engine side of the extension portion of the permanent magnet is to the engine, the magnetic sensor element is arranged such that the magnetic sensor element is at least partially located within a range of ±g in the radial direction from an inner circumferential end surface of the permanent magnet, where g represents a gap length with respect to the radial direction between an outer circumferential end surface of the teeth and the inner circumferential end surface of the permanent magnet. a rotor configured to be fixed to an end portion of a rotation shaft part of an engine, the rotor being in the shape of a tube with a bottom; a stator arranged inside the rotor; and a magnetic sensor unit configured to detect a rotational position of the rotor, the stator including a plurality of teeth that extend in a radial direction of the rotation shaft part, the plurality of teeth being arranged in a circumferential direction of the rotation shaft part, the rotor including a bottom wall portion having a disk-like shape, a peripheral wall portion having a tubular shape, and a permanent magnet, the bottom wall portion being fixed to the rotation shaft part, the peripheral wall portion extending in an axial direction of the rotation shaft part from an outer circumferential edge of the bottom wall portion toward the engine, the permanent magnet being fixed to an inner circumferential surface of the peripheral wall portion, the magnetic sensor unit including a case main body and a magnetic sensor element that is incorporated in the case main body, characterised by the permanent magnet including an extension portion that extends in the axial direction toward the engine beyond an end surface at an engine side of the teeth, the magnetic sensor element being arranged closer to the engine than an end surface at the engine side of the extension portion of the permanent magnet is to the engine, the magnetic sensor element is arranged such that the magnetic sensor element is at least partially located within a range of ±g in the radial direction from an inner circumferential end surface of the permanent magnet, where g represents a gap length with respect to the radial direction between an outer circumferential end surface of the teeth and the inner circumferential end surface of the permanent magnet.