Verse 5

Onan knew that the descendants would not be his but his brother’s, so he entered the house of his brother’s wife and poured out the semen on the ground. In the Lord’s estimation it was an evil act, and he killed him.