they entered [Joseph's city] in the way their father had bidden them, this proved of no avail whatever to them against [the plan of] God.67
[His request] had served only to satisfy Jacob's heartfelt desire [to protect them]:68
for, behold, thanks to what We had imparted unto him, he was indeed endowed with the knowledge [that God's will must always prevail69
]; but most people know it not.
As is shown in the sequence, they and their father were to suffer severe distress before their adventures came to a happy conclusion.
Lit., "it [i.e., his request that they should enter the city by different gates] had been but a desire in Jacob's heart (nais), which he [thus] satisfied". In other words, when he gave his sons this advice, he followed only an instinctive, humanly-understandable urge, and did not really expect that any outward precaution would by itself help them: for, as he himself pointed out on parting, "judgment as to what is to happen rests with none but God". This stress on man's utter dependence on God - a fundamental tenet of Islam - explains why Jacob's advice (which in itself is not relevant to the story) has been mentioned in the above Qur'anic narrative.
This interpolated clause is based on Zamakhshari's interpretation of the above reference to Jacob's having been "endowed with knowledge".