An optical sensor for detecting hydrogen in a fluid in physical contact with the sensor is provided. The sensor includes an optical fiber, wherein an end portion of the optical fiber is coated with a multilayer including: a sensing layer, including a film of an alloy, the alloy including Mg, Ni, and M, wherein M is at least one of Zr, Ta, and Hf, and wherein the alloy has the composition MgxNiyMz, and wherein x is from 40 to 60, y is from 10 to 40, and z is from 10 to 40, and a catalyst layer including Pd. Further, a detection system for hydrogen, including such an optical sensor, and an electrical device having such a detection system are provided.