Foreign direct investment into Canada plunged last year to the lowest since 2010, hampered by an exodus of capital from the nation’s oil patch and worries about the fate of the North American Free Trade Agreement.

Direct investment dropped 26 percent in 2017 to C$33.8 billion ($26.3 billion), Statistics Canada reported Thursday in Ottawa. Capital flows dropped for a second year, and are down by more than half since 2015. The investment that did take place was from reinvested earnings of existing operations. Net foreign purchases of Canadian businesses turned negative for the first time in a decade, which means that foreign companies sold more Canadian businesses than they bought.

The shrinking investment underscores how the energy slump is lingering in a Canadian economy that last year also began to face the additional headwind of growing U.S. protectionism. It also marks a setback for Prime Minister Justin Trudeau’s Liberal government, which has emphasized attracting foreign companies.

Falling foreign direct investment is important. The country’s economy has relied heavily on foreign funding since the global recession -- totaling more than C$500 billion since 2008 and about C$130 billion over the past two years alone, according to balance of payment data.

Unlike portfolio investment, foreign direct investment is considered a stable source of funding that comes with the additional benefits of a transfer of know-how. Instead, an increasing amount of Canada’s funding needs are being met by short-term funds denominated in foreign currencies -- which makes the country more vulnerable to a sudden loss of interest from foreign investors.

ConocoPhillips and Royal Dutch Shell Plc are among the companies that led the exodus from the nation’s energy sector last year. The biggest foreign investment in Canada last year was the purchase by Hong Kong’s richest man, Li Ka-Shing, of Reliance Home Comfort, a water heater and air conditioner firm for C$2.82 billion.

And the numbers continue to move in the wrong direction. According to Bloomberg data, foreign acquisitions of Canadian businesses fell to C$3.8 billion in the fourth quarter, the lowest since 2009.