In 999, large portions of Iran came briefly under the rule of the Ghaznavids, whose rulers were of mamluk Turk origin, and longer subsequently under the Turkish Seljuk and Khwarezmian empires.