Background: The step-by-step determination of the spatio-temporal parameters of gait is clinically relevant since it provides an estimation of the variability of specific gait patterns associated with frequent geriatric syndromes. In recent years, several methods, based on the use of magneto-inertial units (MIMUs), have been developed for the step-by-step estimation of the gait temporal parameters. However, most of them were applied to the gait of healthy subjects and/or of a single pathologic population. Moreover, spatial parameters in pathologic populations have been rarely estimated step-by-step using MIMUs. The validity of clinically suitable MIMU-based methods for the estimation of spatio-temporal parameters is therefore still an open issue. The aim of this study was to propose and validate a method for the determination of both temporal and spatial parameters that could be applied to normal and heavily compromised gait patterns. Methods: Two MIMUs were attached above each subject's ankles. An instrumented gait mat was used as gold standard. Gait data were acquired from ten hemiparetic subjects, ten choreic subjects, ten subjects with Parkinson's disease and ten healthy older adults walking at two different gait speeds. The method detects gait events (GEs) taking advantage of the cyclic nature of gait and exploiting some lower limb invariant kinematic characteristics. A combination of a MIMU axes realignment along the direction of progression and of an optimally filtered direct and reverse integration is used to determine the stride length. Results: Over the 4,514 gait cycles analyzed, neither missed nor extra GEs were generated. The errors in identifying both initial and final contact at comfortable speed ranged between 0 and 11 ms for the different groups analyzed. The stride length was estimated for all subjects with less than 3% error. Conclusions: The proposed method is apparently extremely robust since gait speed did not substantially affect its performance and both missed and extra GEs were avoided. The spatio-temporal parameters estimates showed smaller errors than those reported in previous studies and a similar level of precision and accuracy for both healthy and pathologic gait patterns. The combination of robustness, precision and accuracy suggests that the proposed method is suitable for routine clinical use.