First of all I am new to reading the Quran, so forgive me for any misunderstanding that I may cause.
In Surat Al-Kahf aya 74, the journey between Al-Khidr and Moses, Al-Khidr kills an innocent boy and later on explains to Moses that the boy's parents were of the believers and they feared lest he(the boy) should oppress them with rebellion and disbelief. Here is the whole story taken from alim.org. Not sure if I am citing the right source, so I would welcome any corrections:
Moses said to him (Khidr) "May I follow you so that you teach me something of that knowledge (guidance and true path) which you have been taught (by Allah)?" He (Khidr) said: "Verily! You will not be able to have patience with me! And how can you have patience about a thing which you know not?" Moses said: "If Allah will, you will find me patient, and I will not disobey you in aught." He (Khidr) said: "Then, if you follow me, ask me not about anything till I myself mention it to you. So they both proceeded, till, when they were in the ship, he (Khidr) scuttled it. Moses said: "Have you scuttled it in order to drown its people? Verily, you have done Imra - a Munkar (evil, bad, dreadful) thing." He (Khidr) said: "Did I not tell you, that you would not be able to have patience with me?" (Moses) said: "Call me not to account for what I forgot, and be not hard upon me for my affair (with you)." Then they both proceeded, till they met a boy, he (Khidr) killed him. Moses said: "Have you killed an innocent person who had killed none? Verily, you have done Nukra a great Munkar (prohibited, evil, dreadful) thing!" (Khidr) said: "Did I not tell you that you can have no patience with me?" (Moses) said: "If I ask you anything after this, keep me not in your company, you have received an excuse from me." Then they both proceeded, till, when they came to the people of a town, they asked them for food, but they refused to entertain them. Then they found therein a wall about to collapse and he (Khidr) set it up straight. (Moses) said: "If you had wished, surely you could have taken wages for it!" (Khidr) said: "This is the parting between me and you. I will tell you the interpretation of (those) things over which you were unable to hold patience. 'As for the ship, it belonged to poor people working in the sea. So I wished to make a defective damage in it, as there was a king after them who seized every ship by force. "And as for the boy, his parents were believers, and we feared lest he should oppress them by rebellion and disbelief. So we intended that their Lord should change him for them for one better in righteousness and near to mercy. "And as for the wall, it belonged to two orphan boys in the town; and there was under it a treasure belonging to them; and their father was a righteous man, and your Lord intended that they should attain their age of full strength and take out their treasure as a mercy from your Lord. And I did it not of my own accord. That is the interpretation of those (things) over which you could not hold patience. Surah 18: 60-82
(Bold emphasis is mine.)
Now, it doesn't make sense to kill a boy because his parents were good people and he might have become a bad person had he grown up. Do children have to pay for their future actions? Does it mean you can kill the kids of a believer before they turn into bad people? Please submit your answer with authentic sources.