Updated

The Arab League chose a new chief Sunday, after Egypt switched candidates at the last minute to avert a divisive vote for a post that is usually determined by consensus.

The 22-member Arab organization endorsed Egypt's current foreign minister, Nabil Elaraby, to replace Amr Moussa, whose term expired and who is planning to run for president of Egypt. Moussa, 74, held the Arab League post for a decade.

The Arab League secretary-general's post has traditionally been held by Egypt, home of the League's headquarters. But this year, Egypt and Qatar both put candidates forward.

Egypt has struggled to keep the post, seeing it as symbolic in its bid to maintain its position as a leading Arab nation, particularly in the wake of the Jan. 25 uprising.

Egypt had nominated a member of deposed President Hosni Mubarak's party, an unpopular choice. In an 11th hour change, it substituted Elaraby, 76, a popular diplomat who backed the uprising that ousted Mubarak's regime. Elaraby has had an international career and has earned respect among Arab countries.

After the change was announced, Qatar withdrew its candidate, giving the job to Elaraby.

Qatar's foreign minister, Hamad bin Jassim, said Egypt's choice of Elaraby "encouraged" his country to withdraw its nominee, diplomat Abdul Rahman bin Hamad al-Attiyah of the Gulf Cooperation Council.

"We had an agreement in appreciation of Egypt and the (Egyptian) revolution of Jan. 25, (so) Qatar withdrew its candidate," he told the Arab League meeting. "This is the right choice, which encouraged us to support it."

Elaraby said he came to the meeting without a prepared speech. "It is my pleasure to have this precious trust in me from the council and be named as the League chief," he said.

"I take on this difficult job as the Arab nations are facing many problems," Elaraby said.

Egypt's original candidate was Mustafa el-Fiqqi, a member of Mubarak's ruling party who resigned after Egypt's popular uprising began on Jan. 25. Reform activists opposed his nomination.

Scores protested outside the League headquarters against el-Fiqqi. The crowd cheered when media reported that el-Fiqqi was out as Egypt's candidate.

Only when Egypt was boycotted by other Arab members for its 1979 peace deal with Israel did a diplomat from another country get the job until 1990.

The pan-Arab organization is an umbrella group of countries in the region and tries to reach consensus on political and social issues. It has observer status at the United Nations and recently urged the U.N. Security Council to impose the no-fly zone on Libya.

Although the Arab League often has been more a place for disagreement than for action, many activists are hoping it will play a more active role in coordinating Arab policies and pushing for reform, following the uprisings in the region.

Elaraby was Egypt's U.N. representative in the 1990s and served as a judge on the International Court of Justice in The Hague between 2001 and 2006. He was a legal adviser to Egypt's Foreign Ministry during the peace negotiations with Israel that led to a 1979 peace treaty.

Elaraby, an arbitration expert, was critical of the Mubarak government's crackdown against the popular uprising and was a member of a committee to advise protest leaders on their reform proposals.

For many, Elaraby's move to the Arab League means a loss to an ambitious Egyptian foreign policy. In his brief stint as Egypt's foreign minister, Elaraby said Egypt needs to revise its foreign policy to reflect a "scientific" approach based on international law and human rights. He said Egypt needs to fix its relations with Iran and said it will reopen its borders with Gaza.

Hamas, the Palestinian militant group that rules Gaza, was quick to welcome Elaraby's selection. "We consider this the new beginning toward dramatic changes in Arab foreign relations and foreign policies and we congratulate Egypt for this position," said Hamas spokesman Sami Abu Zuhri.

___

Follow Sarah El Deeb on Twitter: http://twitter.com/seldeeb

___

Ibrahim Barzak contributed reporting from Gaza, Gaza Strip.