Entering a new era of unpredictable politics, South Africa’s newly elected Parliament convened for the first time on Friday as lawmakers prepared to choose the country’s next president after national elections last month.
The long-governing African National Congress, which failed to secure an absolute majority for the first time since it came to power after the end of apartheid, formed a delicate alliance with at least two rival parties, clearing the way for Cyril Ramaphosa to be elected president for a second term.
But the two weeks after the election have been marked by turbulent negotiations between the A.N.C., which Mr. Ramaphosa leads, and rival political parties.
The process has exposed deep fissures within the A.N.C. and in the broader society, and in a telling development, Parliament opened without any kind of formal announcement about a coalition agreement. Lawmakers were being sworn in even as news broke that there was an agreement that removed the biggest obstacle to Mr. Ramaphosa’s re-election.
The president’s party had governed with comfortable majorities since the end of apartheid in 1994. But its popularity has plummeted and it captured only 40 percent of the vote in the most recent election, reflecting the broad discontent of a continental powerhouse struggling with economic stagnation, high unemployment and entrenched poverty.
Having lost its dominance in Parliament, the A.N.C. engaged the broad spectrum of parties that won seats in the National Assembly, seeking to create what it called a government of national unity that would give all of them a role in governing.
The A.N.C. has sought to allay South Africans’ fears that the absence of a single dominant party on the national level for the first time in the democratic era would lead to political chaos, something that has bedeviled municipalities under shared leadership.
“The fundamental question is how do we move South Africa forward,” said Fikile Mbalula, one of the A.N.C.’s top officials, on the eve of the first sitting of the newly elected Parliament. “The majority of political parties in our country believe that this moment requires working together.”
But even before the 400 members of Parliament convened at a convention center along the Atlantic coast in Cape Town on Friday, sharp divides had opened in the new political landscape.
The surprise party of the election, uMkhonto weSizwe, led by the former president and A.N.C. leader Jacob Zuma, boycotted the opening of Parliament after winning 58 seats, the third most of any party.
The party, known as M.K., performed better than any first-year party in the democratic era. But Mr. Zuma has claimed, without providing evidence, that the election was rigged and his party won far more than the nearly 15 percent the electoral commission says it received.
M.K. had demanded that Mr. Ramaphosa, who was Mr. Zuma’s deputy before the two had a bitter falling out, resign if the A.N.C. wants it to join a governing coalition. A.N.C. officials have described that demand as a nonstarter.
The Economic Freedom Fighters, the fourth-largest party — which also has its roots as a breakaway group from the A.N.C. — also appeared to be spurning the call for a unity government.
The party’s leader, Julius Malema, who was an A.N.C. youth firebrand before being expelled in 2012, has said he would refuse to join any coalition that included the second largest party, the Democratic Alliance.
The Democratic Alliance has a predominantly white leadership, and has proposed ending affirmative action laws and other policies that incentivize Black ownership of companies.
“We reject this government,” Mr. Malema said, arguing that the Democratic Alliance promoted racist policies and “white supremacy.”
Instead of joining the A.N.C.’s unity effort, Mr. Malema’s party has teamed up with five others in what they call the progressive caucus.
Resistance to the Democratic Alliance, which received nearly 22 percent of the vote, came from within the A.N.C., too. Some members have openly revolted, as well as partners in labor and the business community, arguing that the Democratic Alliance would seek to impede or even roll back efforts to undo the lingering racial disparities of apartheid.
The pushback forced A.N.C. leaders to walk a delicate line, as they sought to avoid alienating the party’s base of Black voters while also selling the idea that partnering with the Democratic Alliance would be a sensible move for the country.
The Democratic Alliance embraces free-market capitalism, an approach that some A.N.C. leaders believe would help the economy and attract investors. That is in contrast to some of the more aggressive wealth redistribution policies promoted by M.K. and the Economic Freedom Fighters, like nationalizing banks and seizing land from white owners without providing compensation.
Though it vowed last year never to work with the A.N.C. in government, the Democratic Alliance was one of the parties most eager to participate in a unity coalition.
Its leaders had said it was important to prevent what they had called during the election campaign a “doomsday coalition” between the A.N.C. and the Economic Freedom Fighters.
“We approached in a positive and constructive manner, and they have as well,” said Tony Leon, who was part of the Democratic Alliance’s negotiating team.
To soften the blowback, A.N.C. leaders sold a partnership with the Democratic Alliance in tandem with the Inkatha Freedom Party, a Black-led party that is popular with speakers of Zulu, the language most widely used in South African homes.
Inkatha wants chiefs and other traditional leaders to play a greater role in government, and to redistribute land to Black South Africans, but it has proposed a more conservative approach than M.K. and the Economic Freedom Fighters.
The notion of Inkatha working alongside the A.N.C. carries some symbolic significance.
In the turbulent years toward the end of apartheid, fighting between supporters of the A.N.C. and Inkatha left thousands dead and threatened to derail the 1994 election. “This presents an important opportunity between the two political parties to heal the wounds of the past,” said Velenkosini Hlabisa, Inkatha’s leader.
Mr. Mbalula went to great lengths to disavow the narrative that working with the Democratic Alliance, or any other party, would be a betrayal of the A.N.C.’s core historical tenet as Africa’s oldest liberation movement — to liberate the Black majority.
He pointed out that South Africa’s first democratic government, led by Nelson Mandela, was one of national unity in which the A.N.C. teamed up with the National Party, the leader of the apartheid regime.
“We went into government with people who took us to jail,” he said. “Did we die? We didn’t. Did we survive that moment? We did.”
But South Africa is in a very different place now. Where the country coalesced around a push for racial unity back then, this government confronts significant divides, many stemming from an anemic economy.
Immigrants face accusations of taking scarce job opportunities. Most of the economy remains white owned, fueling resentment that white South Africans continue to benefit from the old racist system that favored them. Many Black South Africans have been unable to climb out of gritty townships, reinforcing segregated living patterns.