No one knows when Herat was founded. The name comes from the river, which in Old Iranian meant something like "with velocity", and under the Achaemenid Persians the district was called Haraiva. In 330 BC Alexander took the local capital, Artacoana, and had the town rebuilt with a citadel. By around 430 the town also had a Christian community with a bishop of the Church of the East, though the city was probably mainly Zoroastrian.
Arab armies reached Khorasan in the 650s, and Herat submitted, then rebelled and was retaken more than once. It became a trade hub on routes running from the Mediterranean to India or China, noted for textiles. The Ghurids built the Great Mosque in 1201, and the geographer Mustawfi later credited their era with 359 colleges and 12,000 shops. Bronze work inlaid with precious metal was a local speciality.
The Mongols besieged Herat twice. The second, after a rebellion, dragged on for seven months before ending in June 1222, and by one account the whole population was killed. The city lay in ruins until about 1236. In 1255 the Il-Khan Hulagu confirmed a local prince, Shams al-Din Kart, as ruler, and the Kartid dynasty rebuilt it with mosques and support for writers. That is when Herat began to be called the Pearl of Khorasan.
Timur took the city in 1380 and ended the Kartids a few years later. Under his son Shahrokh, made governor in 1397, the bazaar was restored and enlarged. Then came Sultan Husayn Bayqara, who ruled from 1469 to 1506 with his minister, the poet Mir Ali-Shir Nava'i. The court was known for music and miniature painting. The Musalla Complex, the madrasa of Gawhar Shad and the gardens belong to this age.
After the Timurids, the Uzbeks and the Safavids fought over Herat. Shah Abbas the Great was born here, and every Safavid ruler from Tahmasp I to Abbas I governed it in youth. In the early 18th century the Abdali Afghans took control, and Ahmad Shah Durrani added it to his empire in 1747. Persian forces besieged it repeatedly, and in 1837 the British helped the Heratis beat them back. The Afghan emir Dost Muhammad Khan took the city on 26 May 1863.
The great Timurid complex was dynamited during the Panjdeh incident to deny the advancing Russians its use. That is why you see a few lone minarets and one domed tomb instead of a campus of madrasas. Some emergency repairs were done in 2001, including protective walls around the Gawhar Shad Mausoleum.
Americans built the airport in the 1960s, and Herat became a stop on the Hippie trail between Tehran and Kabul. In March 1979 Ismail Khan's army unit mutinied, and a revolt against the communist government took the city for three days. Reprisals killed between 3,000 and 24,000 people, depending on the source. Soviet bombing in April 1983 damaged half the city. Ismail Khan became the leading mujahideen commander and later governor, and rebuilding brought many development works.
The Taliban took Herat on 5 September 1995, the first Persian-speaking city they captured. Its people, with a name for being liberal and educated, resented the closing of girls' schools. After the 2001 invasion, Northern Alliance forces took the city on 12 November and Ismail Khan returned. NATO handed security to Afghan forces in July 2011. In August 2021 the Taliban took Herat again.