Multimodal and controllable locomotion in complex terrain is of great importance for practical applications of insect-scale robots. Robust locomotion plays a particularly critical role. In this study, a locomotion mechanism for magnetic robots based on asymmetrical friction effect induced by magnetic torque is revealed and defined. The defined mechanism overcomes the design constraints imposed by both robot and substrate structures, enabling the realization of multimodal locomotion on complex terrains. Drawing inspiration from human walking and running locomotion, a biped robot based on the mechanism is proposed, which not only exhibits rapid locomotion across substrates with varying friction coefficients but also achieves precise locomotion along patterned trajectories through programmed controlling. Furthermore, apart from its exceptional locomotive capabilities, the biped robot demonstrates remarkable robustness in terms of load-carrying and weight-bearing performance. The presented locomotion and mechanism herein introduce a novel concept for designing magnetic robots while offering extensive possibilities for practical applications in insect-scale robotics.