Method for fabricating a device for detecting electromagnetic radiation comprising the following steps: ∘ forming a first stack, comprising: • at least one thermal detector resting on a first substrate, intended to detect the electromagnetic radiation, and covered with at least one mineral sacrificial layer made of a mineral material that can be eliminated by a first chemical etching; • a thin encapsulation layer, extending above the thermal detector and contributing to the delimiting of a cavity in which the thermal detector is located, comprising an upper part (16.1) resting on the mineral sacrificial layer; - at least one indentation, called a lateral indentation, extending through the upper part (16.1) of the thin encapsulation layer and part of the mineral sacrificial layer, and being located at a distance from the thermal detector in a plane parallel to the plane of the first substrate; ∘ forming a second stack, comprising: • a thin layer called the supporting layer, transparent to the electromagnetic radiation, resting on a supporting substrate (31, 32), • at least one getter portion positioned on the thin supporting layer and partially covering the latter, and • a thin protective layer, covering the getter portion, made of a carbonaceous material that can be eliminated by a second chemical etching; ∘ assembling the first and second stacks (10, 30) by bringing the thin supporting layer into contact with the upper part (16.1) of the thin encapsulation layer and directly bonding it thereto, so that the getter portion is located in the lateral indentation; then ∘ forming at least one release vent through the thin supporting layer and the upper part (16.1) of the thin encapsulation layer, opening onto the mineral sacrificial layer; then ∘ eliminating the mineral sacrificial layer by the first chemical etching; ∘ eliminating the thin protective layer by the second chemical etching; ∘ depositing a thin sealing layer on the thin supporting layer so as to block the release vent. ∘ forming a first stack, comprising: • at least one thermal detector resting on a first substrate, intended to detect the electromagnetic radiation, and covered with at least one mineral sacrificial layer made of a mineral material that can be eliminated by a first chemical etching; • a thin encapsulation layer, extending above the thermal detector and contributing to the delimiting of a cavity in which the thermal detector is located, comprising an upper part (16.1) resting on the mineral sacrificial layer; - at least one indentation, called a lateral indentation, extending through the upper part (16.1) of the thin encapsulation layer and part of the mineral sacrificial layer, and being located at a distance from the thermal detector in a plane parallel to the plane of the first substrate; • at least one thermal detector resting on a first substrate, intended to detect the electromagnetic radiation, and covered with at least one mineral sacrificial layer made of a mineral material that can be eliminated by a first chemical etching; • a thin encapsulation layer, extending above the thermal detector and contributing to the delimiting of a cavity in which the thermal detector is located, comprising an upper part (16.1) resting on the mineral sacrificial layer; - at least one indentation, called a lateral indentation, extending through the upper part (16.1) of the thin encapsulation layer and part of the mineral sacrificial layer, and being located at a distance from the thermal detector in a plane parallel to the plane of the first substrate; - at least one indentation, called a lateral indentation, extending through the upper part (16.1) of the thin encapsulation layer and part of the mineral sacrificial layer, and being located at a distance from the thermal detector in a plane parallel to the plane of the first substrate; ∘ forming a second stack, comprising: • a thin layer called the supporting layer, transparent to the electromagnetic radiation, resting on a supporting substrate (31, 32), • at least one getter portion positioned on the thin supporting layer and partially covering the latter, and • a thin protective layer, covering the getter portion, made of a carbonaceous material that can be eliminated by a second chemical etching; • a thin layer called the supporting layer, transparent to the electromagnetic radiation, resting on a supporting substrate (31, 32), • at least one getter portion positioned on the thin supporting layer and partially covering the latter, and • a thin protective layer, covering the getter portion, made of a carbonaceous material that can be eliminated by a second chemical etching; ∘ assembling the first and second stacks (10, 30) by bringing the thin supporting layer into contact with the upper part (16.1) of the thin encapsulation layer and directly bonding it thereto, so that the getter portion is located in the lateral indentation; then ∘ forming at least one release vent through the thin supporting layer and the upper part (16.1) of the thin encapsulation layer, opening onto the mineral sacrificial layer; then ∘ eliminating the mineral sacrificial layer by the first chemical etching; ∘ eliminating the thin protective layer by the second chemical etching; ∘ depositing a thin sealing layer on the thin supporting layer so as to block the release vent.