Mr. Vajpayee stepped down as prime minister in May after the BJP was defeated in national elections in May , 2004 .