JOHANNESBURG, Foreign investment in sub-Saharan Africa rose 13% last year to $32 billion, bucking a global downward trend and reversing two years of decline, according to a United Nations report.

Development of new mining and oil projects, a new U.S. development-finance institution and the ratification of an agreement to create a continent-wide free-trade area could further boost foreign direct investment (FDI) in 2019, it said.

Africa stands in sharp contrast to developed economies, which saw FDI inflows plunge 27% to their lowest level since 2004, the United Nations Conference on Trade and Development wrote in its World Investment Report.

Some African countries fared better than others, however. The Southern Africa region performed the best, taking in FDI of nearly $4.2 billion, up from -$925 million in 2017. Foreign investment in South Africa more than doubled to $5.3 billion.

President Cyril Ramaphosa, who took office last year pledging to revive the economy, is seeking to attract $100 billion in FDI to Africa’s most developed economy by 2023.

Though much of the South African jump came from intracompany loans, new investments included a $750 million Beijing Automotive Group plant and a $186 million wind farm being built by the Irish company Mainstream Renewable Energy.

By contrast, inward FDI to Nigeria, a major oil producer, plunged 43% to $2 billion. Investors were put off by a dispute between the government and South African telecom giant MTN over repatriated profits. Banks HSBC and UBS both closed representative offices there in 2018.

That left Ghana, which is in the midst of an oil and gas boom and saw inflows of $3 billion, as West Africa’s leading destination for foreign investment. Italy’s Eni Group was behind Ghana’s largest greenfield investment project.

Ethiopia remained East Africa’s top recipient of FDI at $3.3 billion, despite an 18% drop compared with the year before.

Kenya, Uganda and Tanzania all saw increases in FDI inflows. Foreign investment in Uganda jumped 67% to a record $1.3 billion, boosted by the oil and gas development of a consortium that includes France’s Total, CNOOC of China and London-listed Tullow Oil.

The creation of the U.S. International Development Finance Corp could help support FDIinflows this year. A replacement for the Overseas Private Investment Corp, it will be have a budget of $60 million and a mandate to make equity investments.

The ratification of the African Continental Free Trade Area Agreement could also have a positive effect on FDI, especially in the manufacturing and services sectors, the report said.

The AfCFTA aims to eliminate tariffs between member states, creating a market of 1.2 billion people with a combined GDP of more than $2.2 trillion.