God had promised Isreal both victory and that He would fight their battles if they trusted and obeyed. There are many instances in the Old Testament where this did not happen simply because Israel did not hold up their end of the bargain. Below is an excerpt from the Keil and Delitzsch commentairy on the old testament with brings otu the full meaning of the text;
Jdg_1:18-21
From the Negeb Judah turned into the shephelah, and took the three principal cities of the Philistines along the line of coast, viz., Gaza, Askelon, and Ekron, with their territory. The order in which the names of the captured cities occur is a proof that the conquest took place from the south. First of all Gaza, the southernmost of all the towns of the Philistines, the present Guzzeh; then Askelon (Ashkulân), which is five hours to the north of Gaza; and lastly Ekron, the most northerly of the five towns of the Philistines, the present Akîr (see at Jos_13:3). The other two, Ashdod and Gath, do not appear to have been conquered at that time. And even those that were conquered, the Judaeans were unable to hold long. In the time of Samson they were all of them in the hands of the Philistines again (see Jdg_14:19; Jdg_16:1.; 1Sa_5:10, etc.). - In Jdg_1:19 we have a brief summary of the results of the contests for the possession of the land. "Jehovah was with Judah;" and with His help they took possession of the mountains. And they did nothing more; "for the inhabitants of the plain they were unable to exterminate, because they had iron chariots." הֹורִישׁ has two different meanings in the two clauses: first (וַיֹּרֶשׁ), to seize upon a possession which has been vacated by the expulsion or destruction of its former inhabitants; and secondly (לְהֹורִישׁ, with the accusative, of the inhabitants), to drive or exterminate them out of their possessions-a meaning which is derived from the earlier signification of making it an emptied possession (see Exo_34:24; Num_32:21, etc.). "The mountain" here includes the south-land (the Negeb), as the only distinction is between mountains and plain. "The valley" is the shephelah (Jdg_1:9). לְהֹורִישׁלֹא, he was not (able) to drive out. The construction may be explained from the fact that לֹא is to be taken independently here as in Amo_6:10, in the same sense in which אַיִן before the infinitive is used in later writings (2Ch_5:11; Est_4:2; Est_8:8; Ecc_3:14 : see Ges. §132-3, anm. 1; Ewald, §237, e.). On the iron chariots, i.e., the chariots tipped with iron, see at Jos_17:16. - To this there is appended, in v. 20, the statement that "they gave Hebron unto Caleb," etc., which already occurred in Jos_15:13-14, and was there explained; and also in Jdg_1:12 the remark, that the Benjaminites did not drive out the Jebusite who dwelt in Jerusalem, which is so far in place here, that it shows, on the one hand, that the children of Judah did not bring Jerusalem into the undisputed possession of the Israelites through this conquest, and, on the other hand, that it was not their intention to diminish the inheritance of Benjamin by the conquest of Jerusalem, and they had not taken the city for themselves. For further remarks, see at Jdg_1:8.
The hostile attacks of the other tribes upon the Canaanites who remained in the land are briefly summed up in Jdg_1:22-36. Of these the taking of Bethel is more fully described in Jdg_1:22-26. Besides this, nothing more is given than the list of the towns in the territories of western Manasseh (Jdg_1:27, Jdg_1:28), Ephraim (Jdg_1:29), Zebulun (Jdg_1:30), Asher (Jdg_1:31, Jdg_1:32), Naphtali (Jdg_1:33), and Dan (Jdg_1:34, Jdg_1:35), out of which the Canaanites were not exterminated by these tribes. Issachar is omitted; hardly, however, because that tribe made no attempt to disturb the Canaanites, as Bertheau supposes, but rather because none of its towns remained in the hands of the Canaanites.