The end of the military campaign against the giants brings the primary conquest of the land to a close. This final stage establishes a clear reality on the ground: the complete removal of these inhabitants from the main territories of the Israelites, alongside their continued presence in the Philistine cities.
A careful distinction exists regarding how these populations survived. As [מלבי״ם] explains, there is a fundamental difference between surviving by accident and being left behind on purpose. Within the borders of the newly conquered land, the eradication was absolute. Not a single giant survived, even by mistake. However, in the cities of Gaza, Gath, and Ashdod, their survival was entirely intentional. The Israelites deliberately did not fight them at this stage so that these remaining factions could serve as a future test for the nation.
The continued presence of giants in Gaza requires some historical context. While the capture of Gaza is recorded in the later accounts of the Book of Judges, [רד״ק] clarifies that this was a delayed event carried out by the tribe of Judah only after Joshua had passed away. Throughout Joshua's lifetime, the giants were completely wiped out from inland regions like Hebron, yet they were allowed to remain undisturbed in Gaza and the other Philistine strongholds.