Foreign investment in Africa has taken a hit after serious political and economic tension, but business leaders are optimistic about the continent’s long-term potential.

Analysts at Ernst & Young surveyed 500 business leaders in 30 countries to take a pulse on how investors view the African market for their latest Africa Attractiveness Survey. And while recent years have shown a great deal of optimism, perceptions took a dip in 2014.

“In the past year, Africa has experienced stronger headwinds than in recent times,” Ajen Sita, Chief Executive Officer at EY Africa said in a statement. “At the same time though, economic growth across the continent remains resilient.”

Thanks to rising urbanization and a booming middle class prepared to spend money, many of the strongest investment flows went into sectors such as real estate and construction, along with consumer-based businesses such as financial services and retail. And many respondents were “excited about prospects in the relatively underexploited agricultural sector.”

There are 22 economies on the continent expected to grow by at least 5 percent this year, beating the global average of just 3 percent, but there are still many complications.

For instance, low oil prices have had a major impact on oil-producing countries such as Angola and Nigeria, while the price of commodities -- a mainstay for many African economies -- has been particularly volatile.

Africa was once the second most attractive investment destination worldwide, but this year it slipped behind North America, Asia and Oceania.

“This year’s survey reveals that investor perceptions of Africa reached their lowest level since 2011,” the report says. In the 2014 version, 60 percent of respondents said that Africa had improved, while that rate was just 53 percent most recently. “There was also a slight drop in confidence about the continent’s future investment attractiveness,” it says, noting that some of the main reasons were perceptions of political risk factors such as instability or corruption.

“Greenfield” foreign direct investment (FDI) projects fell 3.1 percent worldwide but dropped 8.4 percent in Africa. Nonetheless, while there were less FDI projects this year, the value of each project increased dramatically. Capital investment into Africa increased 136 percent last year to hit $128 billion, and thanks to a series of “mega deals,” the average investment increased from $67.8 million per project in 2013 to $174.5 million -- the highest rate in five years.

“We do not know whether this is sustainable, but it is certainly cause for celebration,” the report reads.