An optical alignment compensation system for a gas detection system for detecting a gas, the optical alignment system comprising: an array of transceiver pairs (51a, 51b, 51c), wherein each transceiver pair (51a, 51b, 51c) is configured to transmit and receive light with an optical spectrum in an absorption region of the gas to be detected; a retroreflector arranged at a nominal position and configured to reflect the light; an optical element arranged and configured to direct the light from at least one of the transceiver pairs (51a, 51b, 51c) along an optical path through the gas to the retroreflector, to receive the light reflected by the retroreflector along the optical path, and to direct the reflected light to the respective transceiver pair (51a, 51b, 51c); and a control unit configured to select one of the transceiver pairs (51a, 51b, 51c) for transmitting and receiving the light, wherein the control unit is configured to perform a search algorithm to identify the transceiver pair (51a, 51b, 51c) that receives the reflected light with the highest signal response and to select said transceiver pair (51a, 51b, 51c), wherein the search algorithm comprises - a brute-force interrogation of transceiver pairs (51a, 51b, 51c) in conditions of lower signal responses of the reflected light received by the transceiver pairs (51a, 51b, 51c); and - a gradient descent based interrogating of transceiver pairs (51a, 51b, 51c) in conditions of higher signal responses of the reflected light received by the transceiver pairs (51a, 51b, 51c). an array of transceiver pairs (51a, 51b, 51c), wherein each transceiver pair (51a, 51b, 51c) is configured to transmit and receive light with an optical spectrum in an absorption region of the gas to be detected; a retroreflector arranged at a nominal position and configured to reflect the light; an optical element arranged and configured to direct the light from at least one of the transceiver pairs (51a, 51b, 51c) along an optical path through the gas to the retroreflector, to receive the light reflected by the retroreflector along the optical path, and to direct the reflected light to the respective transceiver pair (51a, 51b, 51c); and a control unit configured to select one of the transceiver pairs (51a, 51b, 51c) for transmitting and receiving the light, wherein the control unit is configured to perform a search algorithm to identify the transceiver pair (51a, 51b, 51c) that receives the reflected light with the highest signal response and to select said transceiver pair (51a, 51b, 51c), wherein the search algorithm comprises - a brute-force interrogation of transceiver pairs (51a, 51b, 51c) in conditions of lower signal responses of the reflected light received by the transceiver pairs (51a, 51b, 51c); and - a gradient descent based interrogating of transceiver pairs (51a, 51b, 51c) in conditions of higher signal responses of the reflected light received by the transceiver pairs (51a, 51b, 51c). - a brute-force interrogation of transceiver pairs (51a, 51b, 51c) in conditions of lower signal responses of the reflected light received by the transceiver pairs (51a, 51b, 51c); and - a gradient descent based interrogating of transceiver pairs (51a, 51b, 51c) in conditions of higher signal responses of the reflected light received by the transceiver pairs (51a, 51b, 51c).