Avatar or Expansion of Krishna: Vamana

                                                                  I would like to ask about Vamana avatar. Mahabali is a pure devotee of Krishna and he ruled with all the qualities of a king; all of his people were happy with him. But Krishna came as Vamana and removed him from the earth. Why did He do so?