In Paulo Coelho's The Alchemist, the purpose of Santiago's involvement in the tribal wars (and the reason that the alchemist seems to abandon him) is that Santiago must prove to himself—not to the soldiers or the alchemist—that he is capable of mastering all that he has learned. Until now, Santiago has learned to look for omens along the way and to listen to his heart and the language of the world. He has discovered important things from those he meets, e.g., the crystal merchant. He has found out that some men's "knowledge" (the Englishman) is not worth knowing.
When the alchemist brags to the chieftain about Santiago's powerful gifts, Santiago's first reaction is horror and disbelief—not only for what the alchemist claims, but for what Santiago sees as impossible to achieve on his own part. He has no confidence because he has no sense of his own power. Santiago believes in the power of the alchemist. The alchemist tells the young man that rarely do others believe in your powers:
When you possess great treasures within you, and try to tell other of them, seldom are you believed.
We see this soon after: the alchemist speaks of his "apprentice's" powers, but the chief and his men simply laugh. Ironically, Santiago doesn't believe in himself either! But the alchemist knows how far along the young man has come, and that he is ready to prove himself.
Santiago makes it clear that he is sure he is going to die, for he has never done any of the things the alchemist alludes to in his discussion with chief. Santiago is terribly afraid.
The boy was too frightened to listen to words of wisdom. He had no idea how he was going to transform himself into the wind. He wasn't an alchemist!
Fear can be a powerful motivator, and fear of death motivates like nothing else. In three days, Santiago is brought before the chief to prove that the alchemist's words are true. Facing the possibility of death, Santiago uses all he knows to make the wind move him, just as the alchemist had said. The old man expresses his belief in Santiago's ability to perform:
If a person is living out his Personal Legend, he knows everything he needs to know. There is only one thing that makes a dream impossible to achieve: the fear of failure.
In this process, Santiago learns more about the world, much more about himself, and he even teaches things to the "world"—to the desert; he speaks to the wind and the sun. Ultimately, the boy "controls" the wind, as the alchemist said he could.
While speaking to the sun, Santiago expresses the essence of what is occurring to him during this test, though he doesn't realize it:
...each thing has to transform itself into something better...
Santiago does just this—his transformation comes when he gets the wind to move him. He is able to fulfill the tribal chief's wish, and proves to himself that he is capable.
"The darkest hour of the night came just before the dawn" is a similar to the saying by English theologian and historian, Thomas Fuller. In this instance, Santiago faces what may be his last moment of life if he cannot master the wind. However, at this particular instance—when his prospects for staying alive seem so slim, the darkness represents the most desperate moment for the boy—his death. However, this swiftly changes. In proving himself, it is as if the sun starts to rise; his success is that much greater because things had seemed so bleak a short time before.