In " The Last Guardian " by Jeff Grubb, from the view of Medivh's apprentice - Khagder, it tells that Medivh was possessed and corrupted by Sargeras since birth and in the last few chapters Khadgar, Lord Lothar, Garona and some troops went to Medivh's Tower to kill him. After Khadgar finally killed him(abit with great price), he meets the ghost of Medivh(which is the future Medivh) and realises by demising Medivh was the only way that the real Medivh could really be free. In WCIII, he plays a major role in reuniting the races that was essential to the Legion's defeat in Azeroth.