I best add a trigger warning for my last paragraph.
I remember when I found my ex on dating sites. Looking at photos of women on FB from the dating site. Of course it wasn't him. Silly me and crazy me for even thinking for one minute he had set up a profile on a popular free dating site and that he would be USING it and posting his PHOTO along with multiple FB accounts. He LOVED me. Good grief it's so insulting, but the extra layer of insulting is the horrible gaslighting, denying your reality, denying the evidence when there is no way of wriggling out of it but so many creeps determined to have their cake and eat it. Leading a double life.
My ex was not looking for underage girls but I know that feeling of utter disgust at being gaslighted and the attempts to change your perception, blame it on other people, blame it on you, blame it on technology, as if the technology was setting up profiles independently. It is belittling. Your husband has eventually admitted it, but how long was he going to keep playing you for a fool? Only until he got caught, and he thought he wouldn't. The tears and regret are only for himself and the nice cosy life he stands to lose.
Masturbating over your niece is despicable. Sure, men get turned on by youth, but just WTAF to do this over his own relative. It is possible that this is just the tip of the iceberg. Not inferring he is a paedophile, but then they don't go around with it stamped on their foreheads.
I met a man on a dating site 20 years or so back. He had serious erectile dysfunction, but he blamed it on being a little overweight and out of shape and drinking too much wine. He made a really odd comment about wanting me to wear "plain" underwear in bed. A few days later he said something about his niece being attractive in a way that an uncle should never express it. He expressed appreciation for her budding body. She was 14. A couple of weeks later I saw something odd over his shoulder while he was working on his computer. When he went out, I checked his browser history. It was all teen porn, but the absolute worst was a downloaded photo of a very young girl, she looked no more than 12, in an horrendous position, with a man towering over her. I left and immediately phoned the police and said I would go to court as a witness if I needed to. I never saw him ever again. I never heard back from the police. He wrote me a bizarre apology which I shredded.
Put yourself and your family first. Trust your gut.