Politics and petroleum have brought down Africa’s two biggest economies, South Africa and Nigeria, as both nations look down the barrel of recession. Oil giant Nigeria will release quarterly growth figures Wednesday that most likely will confirm the economy is in recession. And the South African economy, the continent’s most established and mature, has seen slowing growth, with a contraction of 1.2 percent in the first quarter, as the population grows faster than the economy. The government is expected to release its second-quarter growth figures next week. The two nations often see each other as competition. They have in recent years jockeyed for the economic top spot in Africa, with Nigeria recently losing the position to South Africa. But many global investors see them as part of the same Africa package, said Martyn Davies, managing director of emerging markets and Africa at the auditing and consulting firm Deloitte. “South Africa and Nigeria are the bookends, if you will, of the sub-Saharan economy. One’s misfiring, the other one’s in severe contraction,” he said. While South Africa’s economy is more sophisticated and established, “Nigeria was undoubtedly the flavor of the decade at least five, six years ago. For South Africa capital — for global capital flowing into Africa — you had to have a Nigeria player, a piece of Nigeria. … It was too big to ignore.” Nigeria’s economy has been hit hard by a global slump in oil prices, and further harmed by militant attacks on pipelines in the oil-producing Niger Delta region that have dropped production to about 1.5 million barrels a day from around 2.2 million barrels. Another problem for Nigeria is a shortage of foreign currency, which means a shortage of imported raw materials for factories and consumer goods for shops. That drives up inflation. Nigeria’s economy shrank about four-tenths of a percent in the first quarter, and the second quarter is expected to be worse. John Ashbourne, Africa economist at Capital Economics in London, said he expected Nigeria’s economy to shrink by about 3 percent. He thinks, however, that growth will resume next year. Pabina Yinkere, head of research at Vetiva Capital Management in Lagos, said the government had taken encouraging steps by raising fuel prices and allowing the currency to float freely against the dollar. Still, with less tax revenue, Yinkere said, the government may struggle to spend the money it needs to revive the economy. In South Africa, the continent’s hub for financial services, investor confidence and the currency have been rattled by recent political shocks, such as President Jacob Zuma’s decision last year to fire the well-respected finance minister, and then fire his replacement just days later, before finally hiring another former finance minister. New allegations of corruption around the new finance minister have further hit the economy. Zuma himself has been accused of denting South Africa’s image. In 2014, the nation’s top anti-corruption czar determined that Zuma “benefited unduly” by using 246 million rand — at the time, about $23 million — of government money to upgrade his home. Zuma’s camp said the improvements were necessary security measures befitting a head of state. Earlier this year, he was ordered to pay back $500,000, or about 3 percent, of the money. But Davies, a longtime proponent of the “Africa rising” narrative, said Africa might be down but isn’t out. East African economies, he said, like those of Tanzania and Ethiopia, are growing and presenting alternatives for investors, and South Africa and Nigeria can rebound, with time and determination. “I think what they both have in common is the governance story, Nigeria particularly so. Nigeria's is not a short-term correction story,” he said. “In South Africa’s case, we have the corporate muscle, we have incredible institutions, we have very, very deep capital markets, we have very well-run institutions at a business level. We have all the ingredients we need to be a successful emerging market economy. Unfortunately, we haven’t got the political alignment.”