Looking at the genealogy of Jesus - Matthew's for example - one has to wonder if God has some preference for boldness and intelligence, even over moral qualities. This shows up very clearly in the women: Tamar, Rahab, Ruth, and Bathsheba*, but once you notice the pattern you can see it in the men as well. It's not just that sinners are in Jesus's ancestry, though many sermons have been preached on that topic. The specific sins are rewarded. It's disquieting.
*Side note. It was extremely unusual for women to be mentioned in genealogies at all in Jewish and other Mediterranean cultures. Matthew is making a very strong point about their importance here.