Malaysia's Mahathir out as PM as rival wins power 