Gunpowder was invented in 9th-century China as one of the Four Great Inventions, and spread throughout most parts of Eurasia by the end of the 13th century. Originally developed by Taoist alchemists for medicinal purposes, gunpowder was first used for warfare by the Chinese around 904 AD with the deployment of "flying fire" arrows in battle.