Morocco won a vote on Wednesday to lead the United Nations Human Rights Council after a heated showdown with South Africa, which said Rabat's human rights record made it unfit to preside over the body.
The Moroccan candidate, Ambassador Omar Zniber, received 30 votes, and his South African opponent, Ambassador Mxolisi Nkosi, secured 17 in a secret ballot in Geneva.
Prior to the vote, Nkosi told Reuters that Morocco was the "antithesis of what the council stands for" and said the country's election would undermine the body's credibility.
Morocco, in turn, accused South Africa and some other African states of undermining its efforts to hold the position, a prestigious but mostly symbolic post.
"The Kingdom's election, supported by a large number of countries around the globe in spite of Algeria's and South Africa's efforts to counter it, demonstrates the trust and the credibility inspired by Morocco's external actions...," the Moroccan foreign ministry said.
The vote marks a rare public dispute in the African group whose turn it was to lead the 47-member council. It normally strives to take decisions as a bloc.
The dispute, in part, revolves around Morocco's sovereignty claim over Western Sahara, where the Algeria-backed Polisario Front is seeking independence. Morocco has denied allegations of rights abuses against its opponents there.
As part of a broader strategy, Morocco has been courting countries, including African neighbours, to build support for its policies for the former Spanish territory.
It has failed to garner the support of South Africa, which helped organise an event to promote self-determination for the Sahrawi people in Geneva last year.
Rights groups say Morocco's new role should prompt it to safeguard human rights at the highest level.
The UN Human Rights Council, which convenes several times a year, is the only intergovernmental global body designed to protect human rights worldwide. It can increase scrutiny of countries' human rights records and authorise probes.