Afghan president says he left country to avoid bloodshed