The battle of the Mire or Tashkent (1365) was a rare defeat for Tamerlane, and came during a struggle for power within the divided Chaghatay Khanate. The Khanate had been split in two since the 1330s, with Mawarannahr (or Transoxiana) in the west and Moghulistan in the east. Since 1347 Mawarannahr had been ruled by Amir Qazaghan, a ruler who had deposed the puppet khans who had officially held power since the 1330s. For the next decade Qazaghan raided his neighbours, until in 1358 he was assassinated on the orders of Tughluk Timur, the Khan of Moghulistan.
In the chaos that followed this assassination the Moghuls invaded from the east. At this time Tamerlane was a junior member of the Barlas tribe, then ruled by Haji Beg. Haji Beg decided to flee rather than stand and fight. Tamerlane accompanied Haji Beg as far as the Oxus, before turning back, claiming that he would organise resistance against the invaders. Instead he switched sides and became ruler of the Barlas tribe as a vassal of Tughluk Timur. During this period Tamerlane further secured his power by marrying the sister of Qazaghan's grandson Amir Husayn, the ruler of Balkh, and the two men apparently began to plot the defeat of the Moghuls.
Tamerlane's time as a Moghul vassal was short. After a purge of the local leaders Tughluk Timur appointed his son Ilyas Khoja as governor of Mawarannahr. Tamerlane and Husayn promptly rebelled and went underground, existing as bandits and mercenaries for the next few years. Eventually they were able to force the Moghuls out of Mawarannahr and took possession of the capital, Shakhrisabz.
In 1365 Ilyas Khoja returned at the head of a new Moghul army. His two main objectives were the defeat of Tamerlane and Husayn and the conquest of Samarkand. The first of these objectives was achieved early in his campaign. The two armies came together near Tashkent, to the north-east of both Samarkand and Shakhrisabz.
The battle was fought in a thunderstorm that turned the field into a swamp dramatically lit by lightning. Tamerlane commanded on the left, with Husayn on the right.
Tamerlane's men were engaged first, and are said to have gained the upper hand against the Moghuls on their flank. Meanwhile Husayn's advance guard was defeated and pushed back on his main force. Tamerlane pulled back and helped restore the situation, creating an opportunity for Husayn to counter-attack. According to Sharaf al-din's history of Timur this chance was missed because Husayn took offense at the tone of Tamerlane's message.
The two armies camped on the battlefield overnight and the fighting resumed on the next morning. After some early successes Tamerlane and Husayn's forces broke and fled, losing 10,000 men in the retreat.
This was a short-lived setback. Ilyas Khoja went on to besiege Samarkand, but was defeated by the Sarbadar rulers of the city. Although the Sarbadars had been victorious they were so badly weakened by this siege that Tamerlane and Husayn were able to occupy the city, further extending the area under their control.
Over the next five years the alliance between the two men fractured, before in 1370 Tamerlane defeated Husayn at his new capital of Balkh, establishing himself as the main power in Mawarannahr.