and was succeeded by his brother Amr ibn al-Layth, who saw himself as the heir of the Saffarids. In the spring of 900, Amr clashed with Ismail near Balkh, but was defeated and taken into captivity. Ismail thereafter sent him to Baghdad, where he was executed. Ismail was thereafter recognized as the ruler of all of Khorasan and Transoxiana by the caliph. Furthermore, he also received the investiture over Tabaristan, Ray and Isfahan. It was also during this period that the Afrighid dynasty was forced into submission. Before Ismail Samani's major victory against the Saffarids, he had made various expeditions in Transoxiana; in 892, he put an end to the Principality of Ushrusana by seizing all of its lands. During the same period, he put an end to the Bukhar Khudas in Bukhara. In 893, Ismail Samani invaded the territories of the Karluk Turks, taking Talas and converting the Nestorian church there into a mosque. The same year, he conducted a campaign to gather slaves, taking ten to fifteen thousand captives. In 900, Ismail sent an army under Muhammad ibn Harun al-Sarakhsi against Muhammad ibn Zayd, the Zaydi ruler of Tabaristan and Gorgan. The invasion was successful; Muhammad ibn Zayd was killed and Tabaristan was conquered by the Samanids. However, Muhammad ibn Harun shortly revolted, forcing Ismail himself to invade the region the following year. Muhammad ibn Harun thereafter fled to Daylam, while Ismail reconquered Tabaristan and Gorgan. In 901, Amr Saffari was defeated at the battle of Balkh by the Samanids, which reduced the Saffarid dynasty to a minor tributary in Sistan. It was during this period that the Samanids were at their height of power, ruling as far as Qazvin in the west and Peshawar in the east. Ismail is known in history as a competent general and a strong ruler; many stories about him are written in Arabic and Persian sources. Furthermore, because of his campaigns in the north, his empire was so safe from enemy incursions that the defences of Bukhara and Samarkand went unused. However, this later had consequences; at the end of the dynasty, the walls—earlier strong, but now falling apart—were greatly missed by the Samanids, who were constantly under attack by the Karakhanids and other enemies. Ismail died in November 907, and was succeeded by his son Ahmad Samani (r. 907–914). Intermediate period (907–961) Not long after his accession, Ahmad invaded Sistan; by