Eventually, Bodhidharma traveled to the kingdom of Wei where he was invited to teach King Myong-je. Bodhidharma refused the offer and obtained permission to reside at the Shaolin-ssu (Shorin-ji in Japanese) Monastery, in Tungpung County, Honan Province, in the Hao Shan Mountains. Legend has it that, after arriving at the monastery, Bodhidharma meditated yoga style for so long that he lost the use of his legs.
Bodhidharma taught a form of Zen Buddhism, which aims to create a state of grace by sudden illumination (satori). Asceticism and meditation in sitting positions for long periods of time are the two main Zen practices. Bodhidharma found the monks at the monastery were in poor physical condition due to their inactivity and thus were unable to meditate for a long period. It is said that many monks died as result of the harsh training sessions. Therefore, he undertook a program to strengthen them. He taught them the system of integrated physical and mental disciple embodied in the Indian I-chin-sutra that he had been taught as a youngster while a member of the Kshatriya. As references, he used two books on military arts that he had brought with him: the I-Ching (Book of Changes) and the Hsien-sui-ching (Book of Divination).
To strengthen the monks, Bodhidharma added physical and mental training methods that were gradually refined into self-defense techniques that the monks could use to protect themselves against highwaymen. These methods were outlined in the books I-Jin Kyong (muscle development) and Si Shim Kyong (mind cleaning). Since ordinary physical exercises conditioned the body but not the mind, he devised a series of 18 movements that imitated the posture of the 18 different temple idols. When performed perfectly, these movements would give the performer the experience of enlightenment.