The Samanid dynasty came to its end in December 1004.