Pei Xuan was from Jingzhaofu, and served as a judge. He was an excellent swordsman, as well as a scholar. He was brave and loyal, and meted out sentences to criminals accordingly, without showing any mercy. He was thus nicknamed the 'Iron-faced judge' (铁面孔目).
The government was corrupt at that time, and was afraid that Pei Xuan might meddle in their affairs, thus they framed Pei Xuan and sentenced him to be exiled to Shamen Island. On the way, Pei Xuan passed by Yinma River. Deng Fei, Meng Kang and the bandits killed the guards and set Pei free. They invited Pei Xuan to join their bandit gang, and Pei agreed. As Pei was the oldest among the three men, he became the chief bandit.