South Africa’s African National Congress (ANC) will invite other political parties to form a government of national unity, its leader President Cyril Ramaphosa has said.

It comes after last week’s election in which the ANC lost its majority for the first time since the end of the racist system of apartheid 30 years ago.

Mr Ramaphosa called for a national dialogue to help rebuild social cohesion, after a “toxic and divisive” election campaign.

Political parties have just over a week to form a government before parliament convenes to elect the president.

Under South Africa’s proportional representation system, for a government to have a guaranteed majority it would need to be formed of parties which together got more than 50% of the vote.

The ANC took a 40% share, with the centre-right Democratic Alliance (DA) getting 22%, the MK party of former President Jacob Zuma won 15% and the radical Economic Freedom Fighters (EFF) 9%.

Mr Ramaphosa spoke late on Thursday after the ANC’s National Executive Committee (NEC) held a marathon meeting in Johannesburg, saying the party acknowledged people’s complaints.

“We agreed to invite political parties to form a government of national unity as the best option to move our country forward,” Mr Ramaphosa said.

His announcement came after days of speculation about the ANC’s options, such as pursuing a minority government or a coalition with one or two parties.

In the end the president invited all the ANC’s political opponents to engage in talks on co-governing the country.

This is a looser arrangement than a coalition, which is a formal agreement among participating parties to work together and usually involves trade-offs in policies and positions.

A national unity government, on the other hand, would include any party that agreed to a broad set of principles. The idea is that they would support the ANC on key votes such as the budget, but retain their own political and ideological agendas.

Analysts say taking this broad approach could allow the ANC to avoid choosing a coalition partner that may be unpopular with its base.

This is particularly true of the white-led DA. Its free-market agenda makes it the preferred option of the private sector and investors, and is seen as an important signal of stability to the markets.

But its policies are at odds with the ANC’s social welfare programmes and especially anathema to the party’s left-wing base.

“A government of national unity creates this impression that it is a collective working group coming together,” political analyst Sanusha Naidu told the BBC.

It could also “look at how you bring in the DA without necessarily saying we’re working directly with the DA”.

Mr Ramaphosa framed the proposal for a national unity government in the historical precedent of South Africa’s first democracy.

That saw the ANC’s Nelson Mandela as president working with his former enemies in the National Party, which had implemented apartheid.

It also included the Inkatha Freedom Party, a conservative party with an ethnic Zulu base, whose supporters had frequently clashed with ANC activists, leading to thousands of deaths.

“In establishing a government of national unity, we will be drawing on an experience with which South Africans are familiar and which served our country well at a time of great difficulty,” he said.

But the challenges are different.

The ANC is no longer in the majority, and the untested hope of three decades ago has been replaced by splits within the party and starkly different visions of the country between the main parties.

Mr Ramaphosa said negotiators had already held “constructive discussions” with the DA and the IFP, as well as the EFF, an ANC breakaway party that advocates seizing white-owned land and nationalising banks and mines.

The DA has said it will not participate in any government that includes the EFF.

But Mr Ramaphosa said ideological and political differences would not “preclude the possibility of working with any party so long as it is in the public interest” and in keeping with a set of basic principles, such as respecting the constitution and rule of law, shared values of national building and social cohesion and a focus on building an inclusive economy.

The ANC’s five-member negotiating team will now be meeting with a “broad range of parties” to discuss the proposal.

That will include Mr Zuma’s uMkhonto weSizwe (MK) party. He has refused to accept the election result or join a coalition as long as Mr Ramaphosa remains president.

But the MK issued a statement late on Thursday saying it had held an initial engagement with the ANC and a meeting would follow shortly.

Mr Ramaphosa has a reputation as a skilled negotiator and is one of the architects of the historic settlement that led to the 1994 election and the government of national unity that followed.

His counterpart at the time, National Party negotiator Roelf Meyer, told the South African news channel eNCA that Mr Ramaphosa “has all the ability to handle this situation”.

The next week will prove to be one of the biggest tests of those skills.