The short story is that Castiel was working with Metatron on a spell that supposedly would lock up all the anjos in heaven, which Cas believed would give the anjos time to sort out their issues. He succeeds in completely the spell, but Metatron reveals that all the ingredients he gathered was for a spell that would actually cast the anjos out of heaven. Which is what happened at the end of season 8.
Because Medatron (How do you spell that name? :P ) had a plan to cast all anjos down to earth and for that he needed Castiel's grace if I remember right