A German far-right politician, whose party claims "Islam does not belong to Germany," has converted to Islam and resigned his post.