Abbasid Caliph al-Ma’mun was a renowned supporter of the sciences. Art Collection 2/Alamy Stock Photo

Imagine leafing through an old book and discovering some blueprints, in the form of a clearly labeled diagram. They depict a rudimentary face covering, attached to a pipe with a set of bellows at the end. And there’s a simple but effective flap valve there to ensure that the mask is only supplied with fresh air. Anyone wearing the mask would be able to breathe safely in a toxic environment, provided someone else could work the bellows. Around the 19th century, European firefighters were beginning to make use of such things. But this book is far older than that. The gas mask is just one of a hundred amazing inventions laid out all the way back in A.D. 850 in the Book of Ingenious Devices, written in Baghdad by three scholars known as the Banū Mūsā brothers.

Practically every page of the book contains something just as impressive as the gas mask. There are designs for a self-filling lamp, a set of hot and cold water taps, and even entertaining automata. The plans are brief, each one a page of text alongside a diagram or two, but their simplicity belies the extraordinary prescience of the Banū Mūsā. The book represents an early high point in medieval engineering—compiling both inventions from ancient Greece, India, Syria, and Persia with the brothers’ original creations. It was truly a document representing the open approach to learning and the pursuit of knowledge that characterized the era in which it was written—the Islamic Golden Age.

This era, spanning the 8th to 14th centuries, was marked by the rule of the caliphates, vast Middle Eastern empires that became world powers. They also proved to be prosperous ground for human knowledge, as science, mathematics, and the humanities flourished.

A trick wine jug from the Banū Mūsā brothers’ Book of Ingenious Devices. Photo12/UIG/Getty Images

The Banū Mūsā brothers were active near the start of the Golden Age, under the Abbasid Caliphate, specifically the rule of al-Ma’mun, a caliph noted for his love of poetry, philosophy, and science. Al-Ma’mun invested significant resources in establishing the recently founded city of Baghdad as a center of development, including the construction of a great library called the House of Wisdom and the support of a range of scholars and scientists.

Al-Ma’mun was close to the Banū Mūsā, and it is said that he had taken them into his care during their childhood, after they had been left impoverished and alone following the death of their father, a highwayman-turned-astronomer who also happened to be a friend of the caliph. Each of the brothers specialized in a different realm of knowledge: Muhammad exceled in astronomy, al-Hasan focused on geometry, and Ahmad was the engineer. The caliph commissioned them to write this book in order to demonstrate the many scientific principles they had mastered.

Salim al-Hassani, chairman of the Foundation of Science, Technology and Civilization, a nonprofit based in Manchester, England, says al-Ma’mun had a religious incentive to pursue technological innovation. “As prescribed by the Quran and the sayings of Muhammad,” he says, “Muslims should strive to seek knowledge and perform useful deeds that improve quality of life.”

Charlemagne and his court were so amazed that they reportedly believed the clock to be possessed by a djinn.

Access to such advanced technologies may have given al-Ma’mun and other rulers a political advantage, too, granting him an almost supernatural aura when he met with foreign leaders. Under the previous caliphate, for example, a delegation had traveled to the Holy Roman Empire, bearing gifts for its leader, Charlemagne. Alongside an elephant and a silk tent was a state-of-the-art water clock, complete with mechanical horseman that would emerge when the hour was struck. Charlemagne and his court were so amazed that they reportedly believed the clock to be possessed by a djinn.

The crankshaft detailed in the book is a particular example of the brothers’ foresight. The device is used to turn pistons, providing power for engines and other mechanisms. A primitive crankshaft appears twice in the book, a full five centuries before the first known European description of a similar device.

Other designs were so successful that they are still used today. The clamshell grab was designed by the brothers as a sort of long mechanical arm, useful for scooping items from the bottoms of rivers or lakes. Consisting of two fragments of a metal sphere, with chains attached to a handle to open and close the device, it is easily recognized today on a variety of mechanical digging devices, with few variations from the original design.

The siege of Baghdad in 1258, as depicted in a 15th-century manuscript. Public domain

Many of the devices listed in the book demonstrate a pioneering understanding and use of water, specifically hydraulics as a force. And while some of these inventions appear whimsical, such as trick cups that refill from secret compartments and fountains that spray water into a series of elaborate shapes, the devices demonstrate specific engineering principles. The fountain employs several revolutionary techniques to achieve its effect, including a system of weights that function as an automatic switch, changing the shape of the fountain at intervals as the water pressure changes. Timing devices such as these distinguished the Banū Mūsā from their successors for centuries to come, with similar concepts not entering widespread use until the 15th century.

Many prominent scientists working in the ensuing centuries failed to reach the technical standards achieved by the Banū Mūsā. Islamic engineers developing trick vessels and water dispensers in the 13th century were unable to match the advanced use of hydrostatics and aerostatics achieved in the Book of Ingenious Devices, resorting instead to simple siphons to achieve certain effects.

After the Banū Mūsā’s work was published, the brothers remained at the forefront of public life. Their later achievements included accurately calculating the circumference of the Earth and the length of the solar year. Their abilities came to be so well regarded that the brothers were called upon to design new canals and cities, or to assess the size of an invading army.

Around 300 years after the Book of Ingenious Devices was completed, a Mongol army led by Hulagu Khan, grandson of Genghis, arrived at the gates of Baghdad. The House of Wisdom, along with much of the rest of the city, was destroyed. So many books were hurled into the Tigris that it was said the river ran black with ink.

Reconstruction of the Banū Mūsā brothers’ musical automaton, created for the Allah’s Automata exhibition at the ZKM | Center for Art and Media in Karlsruhe, Germany. Karlsruhe 2015, photo © ZKM | Karlsruhe

But the sack of Baghdad was not the end for the the Banū Mūsā’s masterpiece. Ever since its publication, the book had been copied and widely distributed, and had been used as an academic source by other Golden Age scholars. By the time the caliphate fell, the book had also reached Europe through Islamic Spain.

A handful of manuscripts are now housed in prestigious locations worldwide, with the three most complete examples being held in libraries in the Vatican, Berlin, and Istanbul.

Perhaps the vision of the Banū Mūsā is best demonstrated in the form of their mechanical flute player. Thought to be a novelty intended to astound foreign dignitaries, the automaton played an instrument according to a set of instructions set via a method similar to what we would later, at the dawn of the Information Age, call the punch card. In simple terms, that means that three brothers from 9th-century Baghdad invented the world’s first programmable machine, over a millennium before scientists in the Western world would begin the development of the modern computer.