Valjean may be the main character of Les Mis, but Monseigneur Myriel is its heart. But this saintly bishop wasn't always the paragon we know him to be. Turns out, he was a bit of a partier in his youth.
As the narrator tells us, Myriel "was good-looking although of small stature, elegant, graceful, and entertaining; his early life was wholly devoted to worldly matters and affairs of gallantry" (184.108.40.206). "Affairs of gallantry" is 19th-century speak for "a bit of a player"—sounds like this guy knew how to live it up.
Even as he grows into old age, Myriel still gives us glimpses of the young, carefree man still living somewhere inside him, saying that "he put himself on the level of the two old women who shared his life, and when he laughed it was the laughter of a schoolboy" (220.127.116.11). Young at heart or not, he radically changes his behavior when he goes from being a carefree young man to a sympathetic and generous old priest.
One day, though, Myriel realizes that he cares about the suffering of others. This realization, in fact, is one of the things that leads him to enter the church. As we read in Book One of Les Misérables, Myriel is hanging out one day when he feels that "The almost violent serenity of the fateful moment vanished: he was haunted by the ghost of social justice" (18.104.22.168). This ghost haunts him for the rest of his life. He becomes obsessed with helping others, to the point that the people around him would actually prefer it if he were a bit more selfish, because then they wouldn't feel as bad about being selfish themselves.
As Monseigneur Myriel gets older, he earns himself the title of bishop. But he doesn't let his success go to his head. He's so generous to others that he even earns the nickname Bishop Bienvenu: "Bishop Welcome." And all the while, he continues to wonder about the mysteries of God's creations:
He pondered on the greatness and the living presence of God, on the mystery of eternity in the future and, even more strange, eternity in the past, on all the infinity manifest to his eyes and to his senses; and without seeking to comprehend the incomprehensible he contemplated these things. (22.214.171.124)
In other words, he's humble enough to know that, however holy he is, he'll never be holy enough to understand God. We can learn a lot from Myriel's attitude toward the world, which basically boils down to this: we can't judge people or things too harshly because we can never be that certain about anything outside ourselves.
In other words, we should always acknowledge our own uncertainty and give others the benefit of the doubt. This is exactly what Myriel does with Jean Valjean. Instead of punishing Valjean for robbing him, Myriel sees an opportunity to change Valjean's life by letting him go. The last thing he tells the guy is, "Do not forget, do not ever forget, that you have promised me to use the money to make yourself an honest man" (126.96.36.199). It's this kind of unwavering kindness that completely transforms the life of Jean Valjean—and many of Victor Hugo's readers' as well.