God instructed the nation of Israel to wipe out all the male and non-virgin females of lands because of God's love for mankind. The Nephelim were on the earth before the flood of Noah and after the flood. The flood wiped out most of the Nephilim (perhaps even all that existed at the time). But somehow they existed afterward, and the elimination of the Nephilim was accomplished by killing all the male and non-virgain females of lands where Nephilim lived.
To understand why God's solution worked, and why it shows a love for the mankind he created and not a tyrannical act against it, it needs to be understood what a Nephilim is, and also where the spirit of a man/woman comes from.
We see in Genesis 6 that Nephilim are the offspring of the "sons of God" and the "daughters of men". In the 4th century the Roman Catholic church decided the "Sethite" interpretation is the true interpretation of who the "sons of God" and the "daughters of men" are. The "Sethite" interpretation says that the "sons of God" are the line of Seth, and the "daughers of men" are the line of Cain. Since Cain murdered Able, the theory says the line of Cain was cursed, and as such no one from the line of Seth was permitted to marry and produce offspring from the line of Cain. The theory says because the line of Seth violated this restriction, it produced Nephilim and corruption on the earth so bad that God had to wipe it out and start over. Why an offspring from the line of Seth and the line of Cain would produce an offspring worthy of being given a unique name (Nephilim) which means "giant" (some say it also means "fallen ones"), and that these Nephilim would become known as "heroes of old, men of renown" isn't really clear in the theory. But that's what Roman Catholicism and most protestant denominations say is the correct interpretation, and they are sticking to it.
Prior to the 4th century there was much debate as to who the "sons of God" were. While some during those 300 to 400 years of the birth of Christianity believed in the "Sethite" theory, an extention of the belief of Sadducees that angels do NOT exist. Many others at the time believed "sons of God" are angels. The Nephilim are an offspring of an angel and a human woman. Why they would be described as "giants" and "heroes of old, men of renown" makes sense. An offspring of an angel and a human woman would be different than an offspring of a human man and human woman. It could be bigger (a giant). It could be capable of things purely human offspring are not capable of (heroes). It could become a leader (men of renown). In fact, some who believe the "sons of God" = angels theory suggest that the Greek and Roman mythologies may have actually happened to some degree. They suggest that men saw the angels who came down and produced offspring with woman as "gods" and their offspring as "demigods". And the stories of war within those mythologies are why it greived God to the point of wiping it all out with a flood. Regardless of whether the "sons of God" = angels theory is taken so far as to explain Greek and Roman mythology, all who believe the theory say the angels who did this were punished by being locked up in chains in the abyss, and have been there ever since, and will be there until the Day of the Lord and their judgement. You can see references to their imprisonment in the books of 2 Peter and Jude. Their imprissonment took care of them and there sin, but their offspring were alive and causing havoc. An issue God took care of by flooding the earth and drowning them.
Before I go on, let's address where a spirit of a man/woman comes from. In today's day and age it's easy to understand that the body of a human offspring is a combination of both the father's body and the mothers body. Science in the 21st century shows as the two strands of our DNA, one inherited from the father and the other inherited from the mother. But where does the spirit of a human offspring come from? Is it the combination of both the father's spirit and the mother's spirit like the body? Science provides us nothing here as science has no way to test theory in the spiritual realm. What we see from the Bible is that God created the spirit of Adam. He breathed it into existance, and in the image of God's spirit. The spirit of Adam however is not the same as the spirit of God. When God used Adam's rib to create Eve, the spirit of Eve was created from one and only one entity... Adam. When Eve sinned and bit the apple, she then tempted Adam to eat too, and he did.... yet despite Eve sinning first, the Bible is very clear that original sin has been passed down through mankind via Adam. Why? Because no man or womans spirit is the spiritual offspring of the mother. While a persons body is made up of both the body of the father and mother, a person's spirit is made up of ONLY the spirit of the father.
We can see this in the birth of Christ. Mary cannot produce an offspring of her spirit. No woman can. So Mary, despite birthing Jesus and Jesus's body having been made up of Mary's DNA, had nothing to do with where the spirit of Jesus came from. The Roman Catholic Church's belief in the "Sethite" theory of Genesis 6 has caused them to go so far to say that Mary never sinned, and that is why Jesus did not inherit sinful nature by being born from Mary. It is a ridiculous assertation to suggest Mary never sinned, but when you reject the truth of what happened in Genesis 6, it leads one to create lies to explain other doctrins. Mary sinned. The Catholic Church is wrong.
So when we look at "sons of God" being angels and producing offspring with human women, the spirit of that offspring did NOT come from Adam. The Bible does not say where angels came from or when/how they were created. So we do not know the nature of an angel spirit other than we know it is NOT the spirit of Adam that God created. So the Nephilim, in addition to being "giants", and "heroes of old" and "men of renown", they lack God's creation: the spirit of Adam. To God, the are an abomination, corrupting his creation which he loves.
When seen from this interpretation, the flood is an act of love by God towards his creation, mankind, the spirit of Adam. We can also see God commanding Israel to wipe out lands of their males and non-virgin females in the post flood clean up of the Nephilim. If you read about those lands that God command Israel to wipe out the male and non-virgin females, they contained "giants". How Nephilim existed after the flood isn't entirely clear. But Genesis 6 says they were on the earth both in those days (pre-flood) and AFTER.
The "sons of God" = angels theory also explain where demons on the earth came from. God did NOT create demons. The demons are the Nephilim's spirits. When they died in the flood, and when Israel killed them off, their bodies died, but their spirits live on, romaing the earth, and causing havoc. The book of Jubilees suggests that post flood Noah prayed to God to throw the demons in the same abyss as the angels that sinned, and God abided by throwing 90% of them into the Abyss too. The remaining 10% still remain on the earth. When Jesus encoutered the man possessed with the demon call "Legion, for we are many", the demons begged to be thrown into a nearby group of pigs instead of being thrown into the Abyss. They were well aware of the Abyss where the angels and demons are imprissoned, and would rather possess pigs than be thrown into that Abyss too.
When one accepts this theory, and goes so far as to say it explains the Greek and Roman Mythologies, it opens up an understanding of the book or Revelation that actually makes some decent sense, at least compared to the reaches a lot of interpretations attempt to make. This topic itself could be an entire book, but in a nutshell, the Beast with seven heads are the "gods" Diana, Mars, Mercury, Jupiter, Venus, Saturn, and Apollo in Roman Mythology, who are the "gods" Artemis, Ares, Hermes, Zeus, Aphrodite, Crous, and Apollo in Greek mythology respectively. They are also the "gods" that each day of our week is named after (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, and Sunday). They are not "gods" but are angels. They are locked up in the Abyss, and will be released at the 5th Trumpet. They and their fellow angels who sinned, and the 90% of demons that were thrown into the Abyss with them, at the 5th trumpet are released from the Abyss, and cause havoc on earth for 5 months like locusts. And they're leader is Apollo. He is the antichrist. Apollo is the son of Zeus, who is supposed to be the father of the gods. So Apollo is the son of god the father, a status he will use to proclaim he is Jesus Christ, the Son of God the Father. Being angels, they will perform miracles, and decieve the whole world. Revelation says the beast was, is not, but will be again. These angels once existed on earth, do not now, but will again when the 5th trumpet releases them. Their time on earth will be short, because the 7th trumpet, the last trumpet is when God arrives to judge them, and everyone who chose to worship them and accept their mark.
The 1st book of Enoch explains the angels sin in detail, but the books of Enoch are rejected due to what the 3rd, 4th and 5th books get into, such as Enoch becoming an arch angle named "Metatron", and a lot of witchcraft and the occult use the later books of Enoch in their craft. As such, I'm not advocating the study of all the books of Enoch, but the 1st book is a decent read that helps explain that God's love of mankind exists within the context of sinning angels and their demonic offspring that lived among His creation that he loved, mankind, the spirit of Adam.
"For we wrestle not against flesh and blood, but against principalities, against powers, against the rulers of the darkness of this world, against spiritual wickedness in high places." Ephesians 6:12