"As for the boat, it belonged to certain men in dire want: they plied on the water: I but wished to render it unserviceable, for there was after them a certain king who seized on every boat by force. Al-Kahf 18:79 ⧉
Tafsir:
Khidr had not rendered the boat completely useless; he had only made it defective for the time being. The wisdom behind it was that, farther up the river where the boat was going, there was a king who, perhaps in connection with a war campaign, was forcibly confiscating good boats. So, the boat was made defective so that when the king’s agents saw it, they should treat is as undeserving of attention and leave it. This teaches us that a man should not lose heart if he has to face some untoward incident. He should reconcile with it, hoping that there should be some advantage hidden in whatever God has done, though man is not at that time fully aware of it.