Nationalists secure third term in Scotland