In the history of gunpowder there are a range of theories about the transmission of the knowledge of gunpowder and guns from Imperial China to the rest of the world following the Song, Jin and Yuan dynasties. The earliest bronze guns found in China date back to the 13th century, with archaeological and textual evidence for previous nascent gunpowder technology developed beforehand. Scholars note the scarcity of records for firearms in the Middle East prior to the mid-14th century, and in Russia before the late 14th century, yet cannons already appeared in Europe by the early 14th century. This has led to theories that gunpowder or the gun was independently invented in Europe. Less accepted theories include gunpowder as being independently invented in the Middle East or South Asia.

Theories of non-Chinese invention The earliest gunpowder recipe and gunpowder weapons date to China's Song dynasty and the oldest extant guns appear in the Mongol-led Yuan dynasty of China. However, historian Tonio Andrade notes that there is a surprising scarcity of reliable evidence of firearms in Iran or Central Asia prior to the late 14th century. He argues that, in the Middle East, no guns are mentioned prior to the 1360s, while Russian records do not contain reliable mentions of firearms until 1382, after the gun's arrival in western Europe, despite their closer proximity and interactions with the Mongol empires.

European origin

Although there is some evidence that points to the possible appearance of guns in Andalusia as early as the 1330s, Thomas T. Allsen says that "in the Latin West the first uncontestable evidence of firearms is from 1326, surprisingly somewhat earlier than in the lands that lie between China ... and western Europe. This has caused some doubt among historians on the gun transmission theory, and even whether or not there was a transmission at all. One dissident opinion comes from Stephen Morillo, Jeremy Black, and Paul Lococo's War in World History which argues that "the sources are not entirely clear about Chinese use of gunpowder in guns. There are references to bamboo and iron cannons, or perhaps proto-cannons, but these seem to have been small, unreliable, handheld weapons in this period. The Chinese do seem to have invented guns independently of the Europeans, at least in principle; but, in terms of effective cannon, the edge goes to Europe."

There was a stream of thought in Europe that emerged in the early 15th century that attributed the invention of both gunpowder and the gun to a certain Berthold Schwartz (Niger Berchtoldus or "Black Berthold"). By the turn of the 16th century, the story of Black Berthold was being repeated by numerous writers. In 1605, William Camden declared:

It is not exactly certain who Berthold was or if he ever existed as there are no contemporary records of him. Some consider him a mythical figure, used as a stand-in "for all the curious and ingenious experiments related to the new and dangerous mixture of saltpetre, sulfur (brimstone) and carbon." According to Henry Pratap Phillips, Berthold Schwartz was actually named Constantin Anchlitzen, and made gunpowder at Freiburg around the year 1330. J.R. Partington believes Schwartz is a purely legendary figure invented for the purpose of providing a German origin for gunpowder and cannon. Historian Jack Kelly concurs that Berthold was a "legendary figure" that existed to bolster German claims to the invention of the gun and to shield Europeans from the "fact that gunpowder, a critical force in their history, had emerged not from their own inventiveness."

The dating of Schwartz' invention of gunpowder, given by the Jesuit Athanasius Kircher as 1354, is also later than even the first usage of cannons in Europe. The chronological problem did not go unnoticed and in 1732, Hermann Boerhaave shifted the invention of gunpowder to Roger Bacon while Schwartz was relegated to the role of discovering its explosive military properties. In 1753, Peter Shaw dismissed Schwartz by pointing to European usage of cannons as early as 1338. The idea of Berthold Schwartz as the inventor of gunpowder had already begun to decline in the 17th century. Two years after writing about Schwartz' invention of gunpowder, Kircher changed his mind and said that the "invention of gunpowder, which is not possible to deny took place long before our times in China." In 1678, the commander Louis de Gaya downgraded Schwartz' status as an inventor to a mere transmitter. According to de Gaya, Schwartz obtained gunpowder, invented in China, from Tartars during his travels in Muscovy around 1380. The idea that gunpowder was a Chinese invention was not new to Europeans by then, and had been in circulation in Europe since at least the late 16th century. According to Juan de Mendoza, writing in 1585, the Chinese told the Portuguese that they had invented gunpowder, contradicting their own belief that "an Almane" had been the inventor. By the 18th century, missionary writers with access to Chinese records were convinced that gunpowder and firearms had been invented in China. While Europeans increasingly came to accept that gunpowder and other inventions such as paper, printing, and the compass had originated in China, they added an Orientalist twist to the narrative: "only rational Europeans were able to fully utilize the inventions to create the modern age, while the backward Chinese had squandered them." Belief in a European origin also never died entirely. A well known monograph on the history of artillery by Colonel Henry Hime, published in 1915, attributed the discovery of gunpowder to Roger Bacon and claimed gunpowder was brought to China from the West.

Scholars suggest that the lack of gunpowder weapons in a well-traveled Venetian's catalogue for a new crusade in 1321 implies that guns were unknown in Europe up until this point, while the earliest Latin and Arabic descriptions of purifying saltpeter, a key ingredient in gunpowder, does not appear until the 13th century, seven centuries after the Chinese. Others have tried to extrapolate ancient mentions of producing thunder as proof of gunpowder, but invariably run into problems with dating, anachronisms, and interpolations, leading modern arms historians to conclude that true gunpowder was unknown in Europe before the 13th century.

Islamic origin

There is an independent invention theory supporting an Islamic origin of the gun, citing the Mamluk deployment of hand cannons in 1260 and a passage by Ibn Khaldun on the Marinid Siege of Sijilmassa in 1274: "[The Sultan] installed siege engines ... and gunpowder engines ..., which project small balls of iron. These balls are ejected from a chamber ... placed in front of a kindling fire of gunpowder; this happens by a strange property which attributes all actions to the power of the Creator." The passage, dated to 1382, and its interpretation has been rejected as anachronistic by most historians, who urge caution regarding claims of Islamic firearms use in the 1204–1324 period as late medieval Arabic texts used the same word for gunpowder, naft, as they did for an earlier incendiary, naphtha. Needham believes Ibn Khaldun was speaking of fire lances or proto-guns rather than hand cannon.

Historian Ahmad Y. al-Hassan, based on his analysis of 14th-century Arabic manuscripts which he argues to be copies of earlier texts, claims that hand cannons were used at the Battle of Ain Jalut in 1260. However Hassan's claims have been refuted by other historians such as David Ayalon, Iqtidar Alam Khan, Joseph Needham, Tonio Andrade, and Gabor Ágoston. Khan argues that it was the Mongols who introduced gunpowder to the Islamic world, and believes cannons only reached Mamluk Egypt in the 1370s. According to Needham, fire lances or proto-guns were known to Muslims by the late 13th century and early 14th century. However the term midfa, dated to textual sources from 1342 to 1352, cannot be proven to be true hand-guns or bombards, and contemporary accounts of a metal-barrel cannon in the Islamic world do not occur until 1365. Needham also concludes that in its original form the term midfa refers to the tube or cylinder of a naphtha projector (flamethrower), then after the invention of gunpowder it meant the tube of fire lances, and eventually it applied to the cylinder of hand-gun and cannon. Similarly, Andrade dates the textual appearance of cannon in middle eastern sources to the 1360s. Gabor Ágoston and David Ayalon believe the Mamluks had certainly used siege cannon by the 1360s, but earlier uses of cannon in the Islamic World are vague with a possible appearance in the Emirate of Granada by the 1320s, however evidence is inconclusive.

Indian origin

The idea that that ancient Hindus had knowledge of gunpowder traces back to two 18th-century authors: N.B. Halhed and Q. Craufurd. Halhed's Persian translation of a Sanskrit digest of laws, Code of Gentoo Laws (1776), translates agni-astra as "firearms" or "fire-arrow discharged from bamboo," and sataghni, which literally means "hundred-killer" as "cannon." Craufurd's text published in 1790 thought the old Hindus used gunpowder but was doubtful of their use before Europeans. In 1848, Professor Wilson, director of the Asiatic Society at Calcutta, wrote that Indians were well acquainted with gunpowder and that rockets were an Indian invention. According to H.M. Elliot's The History of India as Told by its own Historians (1875), saltpetre may have possibly been used in explosives mentioned in the Ramayana and Sri Bhagavat.

In 1880, Gustav Oppert claimed that the oldest documents describing gunpowder were the Sanskrit texts Sukraniti and Nitiprakasika. The Sukraniti contains descriptions of firearms and a formula for agni-curna (fire-powder) or 'suvarcilavana' (well-shining salt) very similar to that mentioned the Wujing Zongyao: 5 parts saltpetre, 1 part sulphur, and 1 part charcoal. The two firearms mentioned in the Sukraniti are a musket and a cart-drawn gun. There are no definite dates for these works despite claims of their antiquity. Oppert uses archaeological evidence from the ancient temple carvings in India, where soldiers are depicted carrying or in some cases firing the firearms, as proof of ancient use of firearms. Most of these temples are not older than 500 years except Tirupallani temple. However he claims the use of firearms in Sukraniti as authentic and the use of firearms and gunpowder in India since the ancient Vedic period (1500–500 BCE).

The ingredients listed in Sukraniti as constituents for gunpowder such as realgar, opiment, lac, camphor, indigo, pine gum, magnetic oxide of iron, vermillion, graphite are used in the manufacture of incendiary weapons in Arthashastra and also appear in Chinese accounts.