The Qur’an quotes him as saying to the people...
Do not leave upon the Earth any dweller from amongst the unbelievers for surely if You leave them, they will lead Your servants astray and will not beget any but immoral, ungrateful (children).” [^5] In addition, in three separate incidents that occurred, the travel companion of Prophet Musa (peace be upon him) - meaning Prophet Khidhr (peace be upon him) - informed Prophet Musa (peace be upon him) of Knowledge of the Unseen.
The first event was when he damaged the ship; the second was when he killed the young boy; and the third one was when he came across the dilapidated wall in the city which he rebuilt.
In order to remove the surprise and shock of Prophet Musa (peace be upon him), Prophet Khidr (peace be upon him) proceeded to explain his astonishing actions to him by detailing the events that would occur in the future that were hidden from the understanding and knowledge of Prophet Musa (peace be upon him) by saying to him: “Since the oppressive ruler of the time was taking away all of the ships of the people and it was possible that theirs (owner of that ship) too would be taken, I damaged a part of the ship since I wanted this oppressive king to lose interest in this ship.
The young boy that I killed was due to the fact that if he continued to live, he would have chosen the path of rebellion and corruption, and continuing in this course of life, he would have ended up murdering both his mother and father. I fixed the wall that was almost destroyed since under the wall, there was a buried treasure that belonged to two orphans.