I am so sorry to hear this.
Just because you have been together for a long time and have a child doesn't mean that you're meant to be together forever. You still have some decades left to live... you should spend them with someone who will be 100% loyal to you, and whom you can trust completely. If I were in your situation, I would thank him for his honesty, but I would still end things and focus on just being civil for the children.
If you are not religious, don't buy into the "God told me to do it" excuses. Good on him for finding what he believes in, but that does not make him, in any way, exempt from the consequences of his actions. He still took years to tell you what he did, which seriously takes away from the nobility of his confession. The confession was not for your sake, it was so he could clear his own conscience. My advice is to look at removing that burden from your life and focusing on only yourself and your sons until you find someone more stable and trustworthy