Kofi Annan knew he was taking on a "mission impossible" when he started his campaign to persuade President Bashar al-Assad to halt the Syrian war.
But the Nobel Peace Prize-winning former UN leader might not have expected that he would encounter what analysts called "dishonesty, intransigence and incompetence" in his efforts.
Annan did little to hide his bitterness in his resignation comments on Thursday. He said he had taken on a "sacred duty" but "did not receive all the support that the cause deserved."
The 74-year-old Ghanaian criticized "continuous finger-pointing and name-calling" at the UN Security Council for undermining efforts to get his six-point peace plan carried out.
The West blames Russia and China, which have vetoed three UN Security Council resolutions on Syria. Russia, Assad's main ally, says the West wanted only regime change.
"Annan is right to resign," according to Richard Gowan, a director of New York University's Center on International Cooperation, who had said the third veto was caused by "a mixture of dishonesty, intransigence and incompetence" on the Security Council.
"His diplomatic efforts have been completely marginalized. He has shown dogged determination to go on as long as he has, but with very little impact to show for it," Gowan added.
"In retrospect, I think that Annan will be seen as an honorable but unlucky mediator. His six-point plan was a sensible one but was undermined by the lack of honest political support from the great powers at the UN."
Annan devoted nearly all his working life to the United Nations, much of the time seeking to tame dictators and strongmen, such as Saddam Hussein of Iraq and Omar al-Bashir in Sudan.
Two terms as UN secretary-general, during which he won the Nobel prize but was accused of corruption, taught Annan how to look after himself in international negotiations.
Annan's time at the United Nations was also marked by the Rwanda genocide of 1994 and the 1995 massacre of 8,000 Muslim men and boys in the Bosnian town of Srebrenica.
He was the head of UN peacekeeping operations for each disaster. Annan said he could have "done more" to stop the slaughter of 800,000 people in Rwanda and that Srebrenica "will forever haunt the history of the United Nations."
Signup to our newsletter and follow us on Facebook and Twitter!
But he left office at the end of 2006 as one of the most popular UN leaders ever. And diplomats said that since the start of his involvement in Syria, Annan had made it clear that he would not risk his credibility or that of the United Nations by being linked to another dark chapter.
He had taken on past mediation nightmares. In 1998, Annan went to Baghdad to negotiate with Saddam after the late Iraqi strongman threw out UN inspectors looking for signs of nuclear and chemical weapons.
He secured a deal to get inspectors back in, but it soon collapsed and US and British planes were bombing Iraq within months.
In 2004, he went to Khartoum to meet Sudan's Bashir to press for an end to the campaign by Janjaweed militia against civilians in the Darfur region. Bashir relented, but the concessions were again short-lived.
Annan has often been stubbornly independent with the major powers.
He annoyed the United States and Britain when he said their 2003 invasion of Iraq was "illegal" because it was not supported by the UN Security Council.
Some commentators saw the 2005 investigation into Annan and his son over the UN oil-for-food corruption scandal in Iraq as a payback for his invasion comments.
Annan raised eyebrows again last year when he criticized the Western coalition on Libya. The former UN chief said he feared the NATO-led coalition's actions in helping to bring down Moamer Kadhafi had gone beyond the UN Security Council's mandate on Libya.
But Annan has won new praise for his role in helping to end Kenya's deadly turmoil in 2008 after widely criticized elections.
"That was the kind of thing he could do because he was Kofi Annan," said James Traub, a commentator who has written a book about the former UN chief.
But there are differences between the past challenges and Assad, who unleashed government forces on protesters and opposition fighters in a war activists say has left more than 20,000 dead in Syria.
In Kenya, Annan had a "special status" as an African leader in an African setting, said Traub. "That is obviously not true in the Middle East," he added.