The ruler of the Kingdom of Miefa (滅法國; "Miefa" literally means “destroy dharma”) is an unnamed antagonist and now redeemed character of the classic novel Journey to the West. He was known for killing the monks, hence the name Miefa for his kingdom.
For unknown reason, the king of Miefa hated the monks and vowed to slaughter 10,000 Buddhist monks. He has already successfully killed 9,996 monks by the time Xuanzang's group arrive in Miefa. Knowing this, they had to disguise as horse traders. However, that night, the cupboard that they were sleeping in (in order not to accidently reveal themselves as monks when sleeping) is stolen by thieves but is recovered by an official, who decided to bring it to the king.
Sun Wukong casted sleeping spells on the royal household and officials and shaved their heads to make them look like monks, much to their sock in the next morning. Therefore, the king realized his mistakes. When meeting Xuanzang's party, he welcomed them politely, gave them a meal, and agreed to Wukong's request of renaming his kingdom into "Kingdom of Qinfa" (欽法國; "Qinfa" literally means “respect for dharma”).
In the 1986 series, the ruler of the Kingdom of Miefa was amalgamated with the King of the Kingdom of Yuhua. Here, due to a dream of his family being taken away by an evil monk, the king ordered to banish all monks in the kingdom, instead of killing them like in the novel (as Sun Wukong put it, "a ridiculous order" due to "a ridiculous dream").
Like in the novel, all the royal household and officials of the Kingdom of Yuhua were shaved during sleep by Wukong, much to their shock in the next morning. The cupboard that Xuanzang's group was sleeping in was not retrieved by an official, but rather by the three princes themselves, who brought it to their father, assumed that it was them who caused the incident (which they did).
Upon meeting the king, Wukong explained everything to him, much to the king's regret for his stupid decision. Therefore, the King decided to remove the order of banishing all monks, and welcomed Xuanzang's party to his kingdom. Wukong also gave the king, all the royal household and officials their hair back.