In Isaiah 49 is the servant the messiah or is he Israel?

On the one hand he seems to be speaking of Israel but in the next breath it seems that the servant is the messiah who gathers in the remnant of Israel: NIV Isaiah 49: 1Listen to me, you islands; hear this, you distant nations: Before...