Two new compounds containing multidentate chelating organic residues of N-(phophonomethyl)iminodiacetic acid (H4pmida), [M(pyr)(H2O)4][M2(Hpmida)2(pyr)(H2O)2]·2(H2O) (where pyr=pyrazine and M=Co2+ or Ni2+ for I and II, respectively) have been synthesised and structurally characterised by single-crystal and powder X-ray diffraction, elemental analysis, infrared spectroscopy, thermal analysis and solid-state 31P MAS NMR. The compounds contain discrete binuclear anionic [M2(Hpmida)2(pyr)(H2O)2]2− units in which one pyrazine ligand bridges two M2+ cations which are completely trapped inside three five-membered chelate rings formed by the Hpmida3− ligands. These moieties close pack in the ac plane via a series of strong and highly directional O–HO hydrogen bonds leading to the formation of anionic andle=V-WA-A-W-WW-MsSWYVW-UUA-U-AABZBCZYZC-AABBEBDZZC-CAYCDBZVZ-WW-U&_acct=C000050221&_version=1&_userid=10&md5=64478dc8443d9eb4e10a204a72fba51e"> layers. One-dimensional cationic andle=V-WA-A-W-WW-MsSWYVW-UUA-U-AABZBCZYZC-AABBEBDZZC-CAYCDBZVZ-WW-U&_acct=C000050221&_version=1&_userid=10&md5=3d0b1b51acd40c54fb188bad70fa55e0"> coordination polymers are placed in-between and strongly hydrogen-bonded to these layers. The magnetic properties of these two materials are also reported.