Wang Yuanlu 王圓籙—the individual who accidentally stumbled upon the ‘library cave’ or Cave 17 at the Mogao Caves near Dunhuang in June 1900—is behind one of the world’s most significant discoveries. Yet, in the years that followed, he was also responsible for the scattering of the cave’s contents and selling large chunks to Marc Aurel Stein in 1907 and to Paul Pelliot in 1908. How could the self-appointed guardian of this major Buddhist complex part with one of what is often described as its crowning jewels? This article delves into Wang Yuanlu’s motivations and highlights his agency, demonstrating that he was instrumental in shaping the now so-called Stein collection. One of the key sources for this investigation are the published writings of Marc Aurel Stein, which provide the most detailed descriptions of Wang and his activities during the period of the dispersal of the contents of Cave 17. These are supplemented by information drawn from the relevant parts of Stein’s diaries, Paul Pelliot’s writings, and primary sources and recent scholarship in Chinese that shed a different light on Wang’s doings. The article starts by studying Wang’s relationship with the Mogao Caves and their wider ecosystem. It then looks at the subsequent dispersal of the newly found hoard through his transactions with Stein in 1907 and 1914, which are contrasted with his dealings with Pelliot.