UNITED NATIONS -  António Guterres, the former Portuguese prime minister, is set to be the next UN secretary general, after the Security Council agreed he should replace Ban Ki-moon of South Korea, whose term expires at the end of this year.

In a rare show of unity, all 15 ambassadors from the security council emerged from the sixth in a series of straw polls to announce that they had agreed on Guterres, who was UN high commissioner for refugees for a decade, and that they would confirm the choice in a formal vote on Thursday.

“Today after our sixth straw poll we have a clear favourite and his name is António Guterres,” Russian UN ambassador Vitaly Churkin, who is the president of 15-nation body, told reporters with his 14 Council colleagues standing behind him.

“We have decided to go to a formal vote tomorrow morning at 10 o’clock, and we hope it can be done by acclamation.”

The announcement came as a surprise. Many observers had expected the selection process to go on late into October as the major powers struggled to promote their favourite candidates. And some thought that Russia would block Guterres as Moscow had said it wanted an eastern European in the top UN job.

As the UN’s refugee chief, Guterres persistently appealed to the conscience of the international community over the worst refugee crisis since the second world war, and he vowed to carry on being a spokesman for the downtrodden if he became UN secretary general.

“I am totally committed because of what I felt as head of UNHCR for 10 years,” he said during a debate between candidates in London. “You can’t imagine what it is to see levels of suffering that are unimaginable.”

The fact that he was promising to be an activist on humanitarian causes also makes Guterres victory surprising, as both Russia and China in particular have been resistant to outspoken activists in top UN posts. Also there was widespread sentiment this year that it was time for a woman to run the organisation for the first time in its 71-year history and there were several strong female candidates in the contest.

The quick end to the contest was a blow for the European Commission’s Vice-President, Kristalina Georgieva, who made a belated entry to the race last week. Her candidacy only lasted a few days.

The contest to replace Ban as secretary general began in April with public hearings in the UN general assembly, the first time candidates for the job had had to make their pitch in public.

The new transparency was a result of a groundswell of pressure from civil society activists, in the 1 For 7 Billion movement.

Last year Guterres visited Pakistan where urged the world not to “forget” the millions of Afghans forced to live for decades in Pakistan because of war in their home country.

Pakistan has the world’s second-largest refugee population - 1.5 million - most of them Afghans having lived for years in camps in the northwest.