Genesis 38
7 Ref Now Er, Judah's first son, did evil in the eyes of the Lord, so that he put him to death.
8 Ref Then Judah said to Onan, Go in to your brother's wife and do what it is right for a husband's brother to do; make her your wife and get offspring for your brother.
9 Ref But Onan, seeing that the offspring would not be his, went in to his brother's wife, but let his seed go on to the earth, so that he might not get offspring for his brother.
10 Ref And what he did was evil in the eyes of the Lord, so that he put him to death, like his brother.