Responsive materials for which physical or chemical properties can be tuned by applying an external stimulus are attracting considerable interest in view of their potential applications as chemical switches or molecular sensors. A potential source of such materials is metalorganic frameworks. These porous coordination polymers permit the physisorption of guest molecules that can provoke subtle changes in their porous structure, thus affecting their physical properties. Here we show that the chemisorption of gaseous HCl molecules by a nonporous one-dimensional coordination polymer instigates drastic modifications in the magnetic properties of the material. These changes result from profound structural changes, involving cleavage and formation of covalent bonds, but with no disruption of crystallinity.