A method for fabricating a photodetector, comprising the following steps: - providing a substrate comprising: o a first portion successively provided with a first semiconductor film, an electrically insulating layer, a second semiconductor film designed to form a waveguide, and a protection layer, o a second portion successively provided with the first semiconductor film, the electrically insulating layer, and the protection layer and devoid of the second semiconductor film, o a third portion provided with the first semiconductor film, and devoid of the second semiconductor film and the protection layer, the third portion being arranged between the first and second portions (A, B), - partially etching the second semiconductor film in the first portion to form a cavity delineated by the protection layer and the electrically insulating layer, - depositing at least a third semiconductor material so as to form a diode of PIN or NIP type in the third portion from the first semiconductor film and to fill the cavity of the first portion to prolong the waveguide, - depositing a conversion layer in contact with the waveguide and configured to absorb a light signal coming from the second semiconductor film and to convert the light signal into an electric signal, the conversion layer electrically connecting the PIN or NIP diode to form a structure of PIPIN or NINIP type. - providing a substrate comprising: o a first portion successively provided with a first semiconductor film, an electrically insulating layer, a second semiconductor film designed to form a waveguide, and a protection layer, o a second portion successively provided with the first semiconductor film, the electrically insulating layer, and the protection layer and devoid of the second semiconductor film, o a third portion provided with the first semiconductor film, and devoid of the second semiconductor film and the protection layer, the third portion being arranged between the first and second portions (A, B), o a first portion successively provided with a first semiconductor film, an electrically insulating layer, a second semiconductor film designed to form a waveguide, and a protection layer, o a second portion successively provided with the first semiconductor film, the electrically insulating layer, and the protection layer and devoid of the second semiconductor film, o a third portion provided with the first semiconductor film, and devoid of the second semiconductor film and the protection layer, the third portion being arranged between the first and second portions (A, B), - partially etching the second semiconductor film in the first portion to form a cavity delineated by the protection layer and the electrically insulating layer, - depositing at least a third semiconductor material so as to form a diode of PIN or NIP type in the third portion from the first semiconductor film and to fill the cavity of the first portion to prolong the waveguide, - depositing a conversion layer in contact with the waveguide and configured to absorb a light signal coming from the second semiconductor film and to convert the light signal into an electric signal, the conversion layer electrically connecting the PIN or NIP diode to form a structure of PIPIN or NINIP type.