In Volume I, Book the Sixth, Chapter II of Les Miserables, Javert has traced Jean Valjean for a long time. Having been born in a prison, Javert has spent his life in rigid respect for the law, now as a policeman, perhaps to compensate for his beginnings. Now, he comes to M. Madeleine, M. le Maire (mayor) and requests that he be dismissed from his position because he has accused M. Madeleine of being a convict: "I have denounced you at the Prefecture.
Javert tells the mayor that he has thought that M. Madeleine is Jean Valjean because of a certain way that the mayor has of dragging his leg, his strength, and his marksmanship, all of which are like that of Valjean. But, lately, a certain Father Champmathieu has appeared who is a pruner of trees as Valjean was; in addition, convicts such as Brevet who served beside Valjean have recognized Champmathieu as Valjean.
When the mayor asks why Javert feels that he should be "turned out," Javert explains that he has denounced the mayor as a lowly convict,
you, a respectable man, a mayor, a magistrate!...I have insulted authority in your person, I, an agent of the authorities. If one of my subordinates had done what I have done, I should have declared him unworthy of the service, and have expelled him. Well! Stop, Mr. Mayor; one word more I have often been severe in the course of my life toward others. That is just. I have done well. Now, if I were not severe towards myself all the justice that I have done would become injustice. Why, I should be a blackguard! Those who say, 'That blackguard of a Javert!' would be right...I must treat myself as I would treat any other man...I have caught myself in a fault.
Because Brevert and others have identified Champmathieu as Valjean, Javert says he is wrong for having accused the mayor. But, in light of a previous chapter in which the mayor overrode the authority of Javert regarding the jail sentencing of Fantine, the reader has suspicions if Javert is merely playing "cat and mouse" with M. Madeleine.
Nonetheless, Javert is absolutely rigid in his respect for the law and his obedience of it:
I must treat myself as I would treat any other man...
This rigid respect is what causes Javert such torture in his conscience at the end of Hugo's narrative.