CAPE TOWN, South Africa - An anti-apartheid activist was elected South Africa's president on Thursday, assuming what many believe will be a brief caretaker role after Thabo Mbeki was ousted in a power struggle within the ruling party.
South Africa's Parliament, which elects the president from among its members and is dominated by the African National Congress, elected Kgalema Motlanthe with 269 votes to 50 for the main opposition party's nominee.
Jacob Zuma, whose allies engineered Mbeki's ouster, watched from the public gallery. Zuma was not eligible for the presidency because he is not a member of parliament.
Motlanthe is expected to step aside after elections next year, when Zuma was expected to become president.
When the vote results were announced, members of Parliament rose to cheer, and Motlanthe gave a two-thumbs up salute to the gallery. He was sworn in shortly afterward at the presidential office in the Parliament complex.
Later he briefly address the house in measured tones that reflected his reputation as a cool, no-nonsense politician.
"I am deeply humbled and honored by the faith and confidence that the members of this assembly have in me," he said. Motlanthe stood, rocking slightly, as he recited the oath of office, pledging to "do justice to all."
The festive mood at Thursday's parliament session and swearing-in ceremony was in marked contrast to the tumultuous week in South African politics. ANC lawmakers sang anti-apartheid anthems and cheered when Motlanthe cast his vote.
Mbeki did not attend the National Assembly session and Cabinet ministers who have said they were leaving with him also were absent. Among them were the former deputy president, defense minister, intelligence and prisons ministers.
Other members of Mbeki's team have said they would be willing to serve in the next administration.
On Saturday, the ANC ordered Mbeki to quit. Urged on by Zuma's leftist allies, it acted after a judge threw out a corruption case against Zuma on technical grounds and said Zuma may have been a victim of Mbeki's political machinations.
The ANC struggled to reassure South Africa and the world there was no reason to fear instability in Africa's economic and diplomatic powerhouse.
But the situation is fragile, as was clear Tuesday when Mbeki's office announced that 13 ministers and three deputies had resigned from the 28-member Cabinet, among them the highly respected finance minister, Trevor Manuel.
South Africa's stocks and currency reeled. Only later did it become clear that six of those who resigned, including Manuel, had already told the ANC they were willing to serve in a new government. Manuel was expected to be named to a new Cabinet later Thursday.
Zuma is seen as owing his rise to support from labor, the South African Communist Party, and the ANC's increasingly impatient youth wing. But Zuma has said repeatedly he does not plan a major departure from the free market policies of Mbeki and Manuel. South Africa enjoyed unprecedented growth during Mbeki's nine-year tenure, but critics say he did too little to ensure the new wealth trickled down to the black majority.
For all the uncertainty of recent days, some South Africans say the smooth transition was a mark of the maturity of their democracy 14 years after the end of apartheid.
Muzi Sikhakhane, a Johannesburg attorney who was visiting Cape Town and among a handful of people who gathered outside parliament Thursday, said South Africans would "emerge from this stronger."
But he added: "I hope that the new leaders are not just fighting for positions, that they are fighting in order to make our lives better."
South Africans have been anticipating a shift from Mbeki to Zuma at least since December, when Zuma defeated the president in a party election for the ANC's leadership.
Tony Leon, a leading member of the opposition Democratic Alliance, called the ANC ouster of Mbeki in December "brutal, but democratic," and found reason for hope in the events following it that culminated with Thursday's election.
"South Africa's current uncertainty could, over time, lead to far less predictable and far more democratic political outcomes, not immediately, but certainly over time," Leon said in a speech to university students in Cape Town Thursday.
Steve Matomane, an 18-year-old student who also was in the crowd outside Parliament, criticized the way Mbeki was ousted. But he said he did not expect much change in the way his country would be governed.
"As South Africans we don't have to panic," he said. "I think Mr. Zuma will do a wonderful job because he was selected by the ANC and they believe in his ability, his capability."
About 40 people demonstrated in support of Mbeki outside Parliament Thursday. Mzoxolo Sume, a 42-year-old security guard, stood with a sign saying he believed Mbeki had been the victim of a "coup."
"I don't think this is in the interest in the nation," Sume said. "It's about the infighting within the ANC."