In 11th-century Egypt a man named Ibn al-Haytham became the stuff of science legend.
Jennifer Oulette in Physics World:
All the knowledge in the world was at his fingertips. Yet the wisdom of the Ancients could not help him to foresee the ill fortune about to befall him.
One day he received a summons from Cairo's reigning Caliph, al-Hakim bi-Amr Allah – a tremendous honour for a humble scribe. The Scholar felt small and insignificant as he passed through the palace gates into a large courtyard ringed by stone archways; twin minarets cast their shadows over a reflecting pool. He was even more cowed by the majesty of the blue-domed throne room – its stucco walls dotted with bright mosaic tiles. Even the Caliph seemed dwarfed by the setting, despite his robes of state and jewelled turban.
The Caliph was most eager to find a man who could solve a perplexing problem, he explained, and the Scholar came highly recommended. Every year, the flooding of the Nile served as a harbinger for the end of summer, and an omen for that year's harvest. Too much flooding, and the crops would be destroyed; too little, and drought and famine would ravage the land. His people were utterly dependent on the fickle whims of the great river for their survival. Man's ingenuity had already produced watermills to grind grain, and water-raising machines. If men could control water in this way, could they not also build a dam to control the flooding and bend the Nile to the Caliph's will?
The Scholar was flattered by the Caliph's attentions, and tempted by the promise of riches and fame should he succeed. Silencing the doubt in his mind, he told al-Hakim “It can be done.”
More here.