South Africa’s last government of national unity was in 1994. It took four years of hard negotiations to put it together — and it lasted 24 months before former President Frederik Willem de Klerk’s party walked out in a huff from its union with Nelson Mandela’s African National Congress (ANC).

Mandela’s protege Cyril Ramaphosa, now South Africa’s president, and his opponents in the Democratic Alliance (DA) party had 12 days to strike a similar deal. On Friday, these weary rivals reached an agreement to create a new national unity government — though keeping it intact may be far harder than it was 30 years ago.

Yet, despite the peril that both parties now face internally and externally, their union was necessary to steer South Africa away from the economically disastrous, racially polarized, populist future that would have resulted if the ANC joined up with former President Jacob Zuma’s MK Party or Julius Malema’s Economic Freedom Fighters (EFF).