In the 12th century, Turkmen and other tribes overthrew the Seljuk Empire. In the next century, the Mongols took over the more northern lands where the Turkmens had settled, scattering the Turkmens southward and contributing to the formation of new tribal groups. The sixteenth and eighteenth centuries saw a series of splits and confederations among the nomadic Turkmen tribes, who remained staunchly independent and inspired fear in their neighbors. By the 16th century, most of those tribes were under the nominal control of two sedentary Uzbek khanates, Khiva and Bukhoro. Turkmen soldiers were an important element of the Uzbek militaries of this period. In the 19th century, raids and rebellions by the Yomud Turkmen group resulted in that group's dispersal by the Uzbek rulers. In 1855 the Turkmen tribe of Teke led by Gowshut-Khan defeated the invading army of the Khan of Khiva Muhammad Amin Khan and in 1861 the invading Persian army of Nasreddin-Shah.