The law on the protection of horses (baomafa 保馬法, also called baojia yangma fa 保甲養馬法 "law on the rearing of horses by communal security groups") was part of the reform policy of Wang Anshi 王安石 (1021-1086) during the Northern Song period 北宋 (960-1126). It aimed at better conditions for the rearing of horses needed by the military. Horses were often purchased from beyond the borders of China, yet parts of the grasslands in the west at that time were controlled by the Tangutan empire of the Western Xia 西夏 (1038-1227), which were enemies of the Song. Wang Anshi therefore suggested that horses may be bred inside China by specially designed households, whose population was in turn freed from paying taxes. The mutual support of the responsible households was secured by the communal self-defense system (baojia 保甲). The areas where horses could be bred in China were located in five circuits northwest of the capital Kaifeng 開封 (today Hebei and Shaanxi), and directly in its surroundings. The "government horses" (guanma 官馬) were either directly entrusted to the rearing households, or the latter were given money (1,000 copper cash) to buy a horse with. Normally one household was responsible for one animal. If a horse fell ill or died, the household had to pay the cost to buy a new one. In order not to ruin the families, ten households (one security group, bao 保) mutually supported each other in financial matters. The security group was also allowed to use horses for the pursuit of bandits. The system was later expanded to further territories. The period of rearing horses was restricted to 10 or 15 years, after which the duty fell to other regions. With the downfall of Wang Anshi, the system was discontinued.