* Dlamini-Zuma is diplomat, doctor, President Zuma's ex-wife
* Bruising contest between candidates from Gabon, S. Africa
* Deadlock had prompted warning of divided African Union (Updates with quotes, details, background)
South African Home Affairs Minister Nkosazana Dlamini-Zuma was elected on Sunday to become the first female head of the African Union (AU) Commission, ending a bruising leadership battle that had threatened to divide and weaken the organisation.
Cheers broke out at the AU's soaring, Chinese-built steel and glass headquarters in the Ethiopian capital Addis Ababa as supporters of the ex-wife of South African President Jacob Zuma celebrated her victory over incumbent Jean Ping of Gabon.
"We made it!" a grinning Zimbabwean delegate shouted, reflecting the strong support Dlamini-Zuma's candidacy had received from fellow members of the Southern African Development Community (SADC). Ping, who had served in the AU post since 2008, was largely supported by French-speaking African states.
The appointment of South Africa's 63-year-old home affairs minister, who previously served as minister of health and foreign affairs, will add to the global diplomatic clout of an African state which is already the continent's largest economy.
As head of the organisation's executive arm, she faces immediate challenges as the AU tries to gain U.N. Security Council backing for a military intervention in northern Mali, where local and foreign al Qaeda-linked jihadists seized control after a destabilising coup in the southern capital Bamako.
The Mali crisis, along with an army putsch in Guinea-Bissau and border clashes in April between Sudan and South Sudan have blotted Africa's advances in recent years towards better governance and stability, accompanied by buoyant growth.
Dlamini-Zuma had to undergo three voting rounds before Ping, 69, was eliminated. A final confidence vote of 37 in favour gave her the 60 percent majority she needed to be elected.
The contest to head the Commission of the 54-member AU had been deadlocked since a previous vote at a January summit ended in stalemate. The impasse had persisted through a summit of AU heads of state held in Addis Ababa at the weekend.
It prompted the AU's rotating chairperson, Benin President Boni Yayi, to warn African heads of state that failure by the continental body to resolve the leadership deadlock would divide it and undermine its credibility in the world.
"Now we move on to unite the African continent, we unite everybody through Madame Zuma," Lindiwe Zulu, President Zuma's advisor on international affairs, told reporters.
"She won, I congratulate her," Ping told Reuters as he left the AU HQ among a small crowd of well-wishers.
NEED FOR CLEAR DIRECTION
Analysts said the prospect of a further six months of indecision over the AU Commission post appeared to have swayed member states to finally make a choice.
"People really feared a deadlock," Patrick Smith, Editor and Publisher of Africa Confidential, told Reuters.
"Now we have clarity. It means that the other nine commissioners can be elected and the African Union, which has been under a lame duck management recently because of the lack of clarity, has a clear direction and can deal with the real issues," said Jakkie Cilliers, Executive Director of the South Africa-based Institute of Security Studies' Pretoria office.
Smith said Dlamini-Zuma would have to first move to reconcile with the Francophone bloc which supported rival Ping.
This also raised the question of how she would handle the proposed military intervention to reunite divided Mali, an initiative led up to now by the mostly French-speaking West African regional grouping ECOWAS, many of whose members had supported Ping's candidacy.
Critics say the AU showed itself hesitant in its response to the conflicts last year in Libya and Ivory Coast, allowing Western governments to take lead roles.
At a news conference earlier in the day before the vote, Dlamini-Zuma sought to dispel fears that South Africa might seek to use the AU post to try to dominate the continent.
Some smaller countries had argued that her candidacy broke an unwritten rule that Africa's dominant states should not contest the AU leadership.
"South Africa is not going to come to Addis Ababa to run the AU. It is Nkosazana Dlamini-Zuma who is going to come to make a contribution," she told reporters.