South Africa’s President Cyril Ramaphosa is due to sign into law a contentious national health bill that aims to provide universal coverage to millions of poor citizens.

The National Health Insurance (NHI) bill seeks to give South Africans “of all races, rich or poor and legal long-term residents” access to quality healthcare.

It was passed by lawmakers last year and is set to be implemented in stages at a cost of billions of dollars.

The opposition parties and civil society groups wanted the bill to be referred back to parliament, saying it was flawed in its current form.

The bill will be signed into law on Wednesday at the Union Buildings, the presidential office, in the capital, Pretoria, the presidency said.

It comes just days before the 29 May national election that could test the ruling African National Congress’ 30-year rule.

South Africa is still considered one the most unequal societies in the world, with a huge wealth gap and 84% of South Africans relying on often poor quality public healthcare.