A method of manufacturing a detector capable of detecting a wavelength range [λ 8; λ 14] centered on a wavelength λ 10, the detector comprising a detection device capable of detecting said range [λ 8; λ 14] and a hermetic package under a predetermined pressure having said device housed therein, said package being formed of a substrate, of lateral walls attached to the substrate and of an upper cap attached to the lateral walls and comprising a portion vertically in line with the device which is transparent in said range [λ 8; λ 14], the method comprising: - forming said device on the substrate, said forming comprising depositing a sacrificial layer totally embedding said device; - forming the cap on the sacrificial layer, said cap being formed of a stack of first, second, and third optical structures transparent in said range [λ 8; λ 14], the second and third optical structures having equivalent refraction indexes at wavelength λ 10 respectively greater than or equal to 3.4 and smaller than or equal to 2.3; - after the forming of a portion of the cap comprising at least the first optical structure, forming a vent of access to the sacrificial layer through said portion of the cap, and then applying, through the vent, an etching to totally remove the sacrificial layer, in which: - the optical thickness of the first optical structure is greater than or equal to λ 10 / 10; - the equivalent refraction index n eq 1 at wavelength λ 10 of the first optical structure is smaller than or equal to 2.6; and - the surface of the first optical structure formed on the sacrificial layer is inert to the etching implemented to remove the sacrificial layer; and in which the forming of the first optical structure further comprises forming a periodic grating of depressions in the sacrificial layer, the pitch or the period of the periodic grating being smaller than λ 10 3, the forming of the first optical structure resulting in at least partially filling the depressions of said grating. - forming said device on the substrate, said forming comprising depositing a sacrificial layer totally embedding said device; - forming the cap on the sacrificial layer, said cap being formed of a stack of first, second, and third optical structures transparent in said range [λ 8; λ 14], the second and third optical structures having equivalent refraction indexes at wavelength λ 10 respectively greater than or equal to 3.4 and smaller than or equal to 2.3; - after the forming of a portion of the cap comprising at least the first optical structure, forming a vent of access to the sacrificial layer through said portion of the cap, and then applying, through the vent, an etching to totally remove the sacrificial layer, in which: - the optical thickness of the first optical structure is greater than or equal to λ 10 / 10; - the equivalent refraction index n eq 1 at wavelength λ 10 of the first optical structure is smaller than or equal to 2.6; and - the surface of the first optical structure formed on the sacrificial layer is inert to the etching implemented to remove the sacrificial layer; - the optical thickness of the first optical structure is greater than or equal to λ 10 / 10; - the equivalent refraction index n eq 1 at wavelength λ 10 of the first optical structure is smaller than or equal to 2.6; and - the surface of the first optical structure formed on the sacrificial layer is inert to the etching implemented to remove the sacrificial layer; and in which the forming of the first optical structure further comprises forming a periodic grating of depressions in the sacrificial layer, the pitch or the period of the periodic grating being smaller than λ 10 3, the forming of the first optical structure resulting in at least partially filling the depressions of said grating.