From the book of the Wisdom of Solomon (a Deuterocanonical book) Chapter 12:23-27
12:23 And this is why people leading foolish and wicked lives were tortured by you with their own abominations;
12:24 for they had strayed too far on the paths of error by taking the vilest and most despicable of animals for gods, being deluded like silly little children.
12:25 So, as to children with no sense, you gave them a sentence making fools of them.
12:26 Those, however, who would not take warning from a mocking reproof were soon to endure a sentence worthy of God.
12:27 The creatures that made them suffer and against which they protested, those very creatures that they had taken for gods and by which they were punished they saw in their true light; and he whom hitherto they had refused to know, they realised was true God. And this is why the final condemnation fell on them.
Culled from the Good News Bible with Deuterocanonical Books