Josiah Harlan, Prince of Ghor (June 12, 1799 – October 1871) was an American adventurer who claimed to have travelled to Afghanistan and Punjab with the intention of making himself a king. He claimed that during his travels, he became involved in local politics and factional military actions. He claimed he was awarded the title Prince of Ghor in exchange for military aid. Rudyard Kipling's 1888 short story "The Man Who Would Be King" is believed by some to have been partly based on Harlan.

Harlan's childhood Harlan was born in Newlin Township, in Chester County, Pennsylvania. Harlan and his nine siblings—including paleontologist Richard Harlan—were raised in a strict and pious home by Quakers. His father was a merchant broker in Philadelphia.

After the death of his mother when he was 13 years old, Harlan took up reading. It was recorded that at the age of 15, he was reading medical books, such as the biographies of Plutarch. He also allegedly held interest in advanced religious texts. Harlan had a knack for languages, as he was able to speak French fluently and could read in both Greek and Latin. Furthermore, he enjoyed studying Greek and Roman ancient history, with Alexander the Great bearing a particular point of interest for him.

Early travels In 1820, Harlan embarked on his first travels after joining the Freemasons. His father secured him a job as a supercargo on a merchant ship bound for Asia, sailing from Calcutta, India to Guangzhou, China and back. After his return, he fell in love with Elizabeth Swaim. Soon after, they got engaged and planned to marry after he returned from the voyage to India and China. However, she married someone else and Harlan vowed to never return to America.

In July 1824, he enlisted as a military surgeon with the East India Company, despite his lack of medical training. The company was about to enter the war in Burma and needed surgeons. Relying on self-study and some practice while at sea, Harlan presented himself to the medical board for examination and was hired as a surgeon in the Calcutta general hospital. In January 1825, he served with the army in Burma. Owing to heavy losses due to disease and war, Harlan sometimes fought with the Bengal Artillery, acquiring military experience. Harlan claimed he was at the Battle of Prome in 1825, where Anglo-Indian forces stormed the city of Prome (modern Pyay) and engaged in fierce hand-to-hand fighting with the Burmese. The Treaty of Yandabo in 1826 ended hostilities.

Once recuperated, Harlan was posted to Karnal, north of Delhi. There, he read the 1815 book: An Account of the Kingdom of Caubul, and its dependencies in Persia, Tartary and India, comprising a View of the Afghan Nation and history of the Dooraunee Monarchy by Mountstuart Elphinstone, a civil servant with the East India Company who had visited the Durrani Empire in 1809. To many Westerners at that time, Afghanistan seemed remote and mysterious. Elphinstone's book described a nation that no Westerner had ever before visited, which quickly became a bestseller. Harlan was interested in the idea of a medieval Afghanistan, where tribal chiefs battled for supremacy.

Harlan was a strict disciplinarian who would not tolerate any insubordination from those serving under him. But he himself had difficulty taking orders and was openly insubordinate towards his superiors. Harlan began to learn Hindi and Persian. In the summer of 1826, he quit his service with the East India Company. As a civilian, he was granted a permit to stay in India by the Governor-General Lord Amherst. According to his writings about this time Harlan decided to travel to Punjab, which was then beyond the realm of British rule.

Entering Afghanistan After a stay in Shimla, Harlan came to Ludhiana, a border outpost of the British East India Company on the river Sutlej, which formed the border between the Sikh Empire and British India at the time. Harlan had decided to enter the service of Ranjit Singh, the Maharaja of Punjab. Ranjit Singh was willing to hire Westerners who could be useful to him, but generally did not allow them to enter Punjab. He knew that the East India Company possessed much of the Indian subcontinent, and as far as he was concerned, the less known of Punjab the better. So, Punjab became a rather mysterious region for Westerners. The East India Company's agent in Ludhiana, Captain Claude Martin Wade, described Harlan as an enigmatic character who dressed well, knew much about the flora of India and the classics, and wanted to become a mercenary for Ranjit Singh. This made him the first classicist/botanist/soldier of fortune that Wade had ever met. Harlan planned to study the flora of the Punjab, which was unknown in the West, and publish a book about the botany of Punjab with a special emphasis on flowers.

While awaiting an answer to his request to enter Punjab, Harlan heard that the deposed King of Afghanistan lived in exile in Ludhiana. According to rumor, he was fabulously wealthy, and Harlan decided to enlist in his service, sending him a letter offering "a general proposition affecting the royal prospects of restoration". At Shah Shuja Durrani's palace, Harlan discovered a court of grotesquely deformed men. Shuja had a habit of removing the ears, noses, tongues, and genitalia of his courtiers and slaves when they displeased him, and they all offended him at some point. Harlan commented Shuja's court was an "earless assemblage of mutes and eunuchs in the ex-king's service". Harlan spoke no Pashto and Shuja no English, so they conversed in a mixture of Hindi and Persian. Harlan praised "the grace and dignity of His Highness's demeanor", observing the sense of power that Shuja projected, but also that "years of disappointment had created in the countenance of the ex-King an appearance of melancholy and resignation". When Shuja went out for a picnic with his wives, a gust of wind blew down his tent,Dalrymple, William Return of a King, London: Bloomsbury, 2012 page 47. and Shuja became enraged. Much to Harlan's horror, Shuja had his chief slave, an African named Khwajah Mika who had arrived in India via the slave markets of Zanzibar, castrated on the spot.Dalrymple, William Return of a King, London: Bloomsbury, 2012 page 47.

Shuja agreed to hire Harlan, and Harlan had a tailor in Ludhiana sew an American flag, which he used to imply that he was working for the U.S. government, as he went about recruiting mercenaries to restore Shuja. By the fall of 1827, Harlan had recruited about 100 mercenaries, a mixture of Hindus, Muslims and Sikhs interested in loot and plunder.

Writing about Afghanistan's unstable politics, its frequently overthrown rulers, and the penchant for sons to conspire against their fathers, and brothers against brothers, Harlan noted: "The prize was literally handed about like a shuttlecock. The king who in the battle may have dispatched a favorite son in the command of his army would probably before night find himself flying from his own troops." Afghanistan was dominated by a feud between two families, the Durrani and the Barakzai, and furthermore, the men of the Durrani and Barakzai families were just as much inclined to feud with other family members as they were with the rival families. Shuja, who belonged to the Durrani family, had, together with his brother Mahmud, overthrown and blinded their brother Zaman. Shuja then deposed Mahmud and was overthrown by Mahmud, who in his turn was overthrown by the Barakzai brothers after he had their father, Fateh Khan, publicly chopped to pieces. In turn, the Barazkais were now feuding among themselves. 72 Barakzai half-brothers now ruled Afghanistan. Muslim traditions of polygamy allowed a man to have four wives at once, and an unlimited number of concubines, so their father had a surplus of sons. Given this history, and the fact that Afghan tribal chiefs tended to be loyal only to those who paid them the most, Harlan believed that despite the small size of his force that he could topple the Emir, Dost Mohammad Khan, who was the most able and intelligent of the fractious Barakzai brothers.

With financial support from Shuja Shah Durrani, Harlan travelled along the Indus and into Afghanistan, first to Peshawar then to Kabul. During his journey, Harlan discovered in Ahmedpur two deserters from the East India Company's army, James Lewis, better known by his pseudonym Charles Masson, and Richard Porter aka "John Brown", who tried to persuade him that they were Americans, but Harlan couldn't help but notice their English accents. Harlan correctly guessed that the only reason two Englishmen out in the wilderness would try to pass themselves off as Americans was that they were deserters. The two deserters joined Harlan's army and maintained the pretense of being two gentlemen from Kentucky who had decided to explore the Hindu Kush. As he entered Afghanistan, Harlan first met the warlike Pashtun tribes and learned about their strict code of Pashtunwali ("the way of the Pashtuns") under which any insult, real or perceived, had to be avenged with swift and blinding violence while at the same time, a man had to be courteous and honorable to all, including his enemies. As Harlan's army was close to mutiny, he decided he would enter Afghanistan disguised as a Muslim dervish (holy man) returning from a pilgrimage to Mecca. Much to Harlan's fury, Masson deserted his army and inspired several others to follow his example. Harlan knew only a few phrases in Arabic, but with these he convinced a Pashtun chief that he was a dervish returning from Mecca. Shuja followed Harlan's force with his own troop of mercenaries, seizing Peshawar, the summer capital of Afghanistan. He behaved with such arrogance towards the Pashtun chiefs who had come to swear loyalty to him, expecting lavish financial rewards, that they went back to the Bazakzai brothers, who did not use court etiquette to humiliate them as Shuja had done.Dalrymple, William Return of a King, London: Bloomsbury, 2012 page 45.

Harlan met Dost Mohammad Khan, whom he had come to depose, in Kabul at Bala Hisar Fort. The custom of Pashtunwali ensured that Dost Mohammad would choose to treat Harlan as an honored guest. By this time, Harlan had become fluent in Persian, the lingua franca of the Muslim world, and it was in that language that he and Dost Mohammad talked. Even though Harlan had come to Afghanistan to overthrow Dost Mohammad, upon meeting him, he discovered he rather admired him. Unlike the rulers from the House of Durrani, who used the title of Shah (Persian for king), the monarchs of the House of Bazakzai used the less grand title of Emir (Arabic for prince). Pashto had such low status in the Muslim world that both the Durranis and Barakzais used Arabic and Persian titles to improve their prestige.Dalrymple, William Return of a King, London: Bloomsbury, 2012 page 73 Harlan had arrived assuming the West was superior to the East, but meeting Dost Mohammad challenged his thinking, as he found Easterners could be just as intelligent as Westerners. When Dost Mohammad asked Harlan to explain the American system of government to him, Harlan spoke about the tripartite separation of powers between the President, Congress, and the Supreme Court. The Emir remarked that the American system did not sound much different from the Afghan system, where there was a tripartite separation of powers between the Emir, the tribal chiefs, and the Ulama (Islamic clergy who also served as judges). Harlan noted that although a Muslim, Dost Mohammad drank heavily and had brought prostitutes to his court; Harlan described them as "promiscuous actors in the wild, voluptuous, licentious scene of shameless bacchanals".Meyer, Karl & Brysac, Shareen Blair The Tournament of Shadows The Great Game and the Race of Empire in Central Asia, Washington: Counterpoint, 1999 page 68.