al-Sikandar Dhul-qarnain and al-Khidr
The aspect of Khidr-as-Friend is evident in the episode of Dhul-qarnain who in Islamic mysticism is equated with Alexander the Great ('The Two Horned One'), and also Moses.
Surah 18 (Kahf) says:
"They will ask you about Dulqarnein. Say: "I will give you an account of him.
"We made him mighty in the land and gave him means to achieve all things. He journeyed on a certain road until he reached the West and saw the sun setting in a pool of black mud. Hard by he found a certain people.
"Dhulqarnein", We said, "You must either punish them or show them kindness.
He replied: "The wicked" we shall surely punish. Then they shall return to their Lord and be sternly punished by Him. As for those that have faith and do good works, we shall bestow on them a rich reward and deal indulgently with them.
"He then journeyed along another road until he reached the East and saw the sun rising upon a people whom We had utterly exposed to its flaming rays. So he did; and We had full knowledge of all the forces at his command.
"Then he followed yet another route until he came between the Two Mountains and found a people who could barely understand a word.
" Dhulqarnein", they said " Gog and Magog are ravaging this land. Build us a rampart against them and we will pay you tribute."
"He replied: "The power which my Lord has given me is better than any tribute. Lend me a force of labourers, and I will raise a rampart between you and them. Come, bring me blocks of iron."
"He dammed up the valley between the Two Mountains, and said: "Ply your bellows." And when the iron blocks were red with heat, he said: "Bring me molten brass to pour on them."
"Gog and Magog could not scale it, nor could they dig their way through it. He said: "This is a blessing from my Lord. But when my Lord's promise is fulfilled, He will level it to dust. The promise of my Lord is true."
On that day We will let them come in tumultuous throngs. The Trumpet shall be sounded and We will gather them all together.
On that day Hell shall be laid bare before the unbelievers, who have turned a blind eye to My admonition and a deaf ear to My warning.