The Night Kings were a line of royal monarchs who ruled a pre-Hebitian culture on a planet near what would become the Cardassian-Federation border. The Night Kings had been selectively bred by the dithparu, an ancient group of non-corporeal imprisoned on the same planet and confined to an energy field called the Well of Souls. This royal line was made genetically able to host the dithparu, and each king, upon the death of his predecessor, would partake in a ritual where the being possessing the old king would then possess the new one.
The Night Kings ruled this way for generations, until approximately 6000 years prior to the 24th century. At that time, the heir to the throne, Prince Nartal, abandoned the death ritual before Uramtali, the leader of the dithparu, could possess his body. Nartal returned to his people claiming to have undergone the ritual, but in short time, his lack of the knowledge only the dithparu had caused their society to crumble and collapse. (ST - The Lost Era novel: Well of Souls)