Cyril Ramaphosa on Thursday was elected as South Africa's new president by ruling party legislators after the resignation of Jacob Zuma.

Ramaphosa was the only candidate nominated for election in the parliament after two opposition parties said they would not participate. The opposition parties instead unsuccessfully called for the dissolution of the National Assembly and early elections.

Chief Justice Mogoeng Mogoeng presided over the parliamentary election and congratulated Ramaphosa, who had been Zuma's deputy and has called for a fight against corruption.

Zuma resigned after years of scandals that damaged the stature of the ruling African National Congress party.

The opposition Democratic Alliance party will cooperate with Ramaphosa if he acts in the interests of the South African people, said party leader Mmusi Maimane.

"We will hold you accountable and I will see you in 2019 on the ballot box," Maimane said.

Members of a smaller opposition party walked out of parliament before the election, saying the ruling ANC party plan to choose a new president was "illegitimate."

Julius Malema, leader of the Economic Freedom Fighters party, said ANC lawmakers had failed to hold former Zuma to account for alleged corruption and had therefore violated the constitution.

Cyril Ramaphosa South Africa ANC
Acting President of South Africa Cyril Ramaphosa reacts as he arrives at Parliament in Cape Town, on February 15, 2018 for a session to officially deal with former President Zuma's resignation and his possible election and swearing. South Africa prepared to welcome wealthy former businessman Cyril Ramaphosa as its new president on February 15, 2018 after scandal-tainted Jacob Zuma resigned under intense pressure from his own party. MIKE HUTCHINGS/AFP/Getty Images

Ramaphosa is South Africa's fifth president since majority rule started after the end of apartheid in 1994. On Friday evening, he is expected to deliver the state of the nation address that had been postponed during the ruling party's days of closed-door negotiations to persuade Zuma to resign.

Zuma resigned in a nationally televised address late Wednesday after the ANC instructed him to step down or face a parliamentary motion of no confidence that he would almost certainly lose.

The South African currency, the rand, strengthened against the dollar in early trading Thursday after Zuma's resignation, which ended political turmoil that had stalled some government business.

On Thursday the foundation of Nelson Mandela, South Africa's first black president, welcomed Zuma's departure but said the state must act against "networks of criminality" that have hurt the country's democracy.

As the country marks the centenary of Mandela's 1918 birth, "there is a need to reckon with the failures of the democratic era," the foundation said. "We believe that we are at a critical moment in our history, one which offers us the unique opportunity to reflect, to rebuild, and to transform."