Cargill Inc. posted a rare loss — $51 million for its fiscal fourth quarter — capping a mediocre year marked by weakening economic conditions in emerging markets.

The Minnetonka-based agribusiness giant posted net earnings of $1.58 billion for the fiscal year ending May 31, down 13 percent from a year ago.

“While several Cargill businesses generated very strong earnings in fiscal 2015, we lagged results from the prior year and did not meet our own expectations,” David MacLennan, Cargill’s president and chief executive, said in a statement. “The economic environment remains sluggish in many emerging markets where we have invested significantly over the past several years.”

Cargill’s fourth-quarter loss, which was due to one-time charges, compared to a profit of $376 million a year ago. It was the first loss for Cargill since its fiscal fourth quarter in 2001.

MacLennan noted that all four of the company’s business segments were profitable. The loss in the three-month period resulted from charges taken at the corporate level, including an asset impairment related to a software system and another charge tied to Venezuela’s currency meltdown.

Cargill’s fourth-quarter revenue was $28.4 billion, down from $36.2 billion a year earlier. For the fiscal year, revenue was $120.4 billion, down 11 percent from the previous year.

Cargill is one of the world’s largest privately held companies, with interests in everything from grain trading to chocolate making and road salt.

The company’s animal nutrition and meat processing business posted increased profits for the full year, with particularly strong results in animal feed, Central America poultry and U.S. pork, turkey and egg processing. The U.S. results came despite a bird flu epidemic that hobbled the U.S. egg and turkey markets.

However, fourth-quarter earnings in animal nutrition and meat processing declined from a year ago. High cattle costs hurt Cargill’s beef business.

Fourth-quarter profits in grain origination and processing, which includes trading and exporting, also lagged the year-ago quarter. However, full-year earnings in that segment were up slightly over the previous year. Results in North America were strong, particularly in soybean crushing.

The grain business’ results in South America were hampered by lower prices for corn and soybeans, which caused farmers to hold their crops. In Europe, earnings were hurt by the armed occupation of Cargill’s large sunflower seed processing plant in Donetsk, Ukraine. The plant has been shut down now for 11 months.

Cargill isn’t alone in experiencing soft results in the grain business. Over the past week, Archer Daniels Midland and Bunge both posted earnings that fell short of analysts’ forecasts.

In all commodities, stocks are being rebuilt, which is decreasing price volatility, Cargill Chief Financial Officer Marcel Smits said in an interview with the Star Tribune. That limits trading opportunities for companies like Cargill.

Earnings in Cargill’s food and ingredients business were lower in both the fourth quarter and the full year compared to the same periods last year.

Part of the problem is an economic slowdown in emerging markets and China. For example, Cargill opened a sweetener plant in Brazil over the past year amid a contraction in that country’s GDP, Smits said. A few years ago, when Cargill decided to build the plant, Brazil’s economy was booming.

Cargill’s food ingredients business last year also was hurt by consumers’ growing distaste for carbonated beverages in developed economies. Cargill is a major producer of high-fructose corn syrup, a staple in soda pop. The soda market is in decline and “we don’t see it coming back,” Smits said.

Cargill’s industrial and financial services segment, its smallest business, posted an upturn in the fourth quarter, but not for the full year.

Cargill’s fourth-quarter charges were primarily related to a “wall-to-wall” business software system, Smits said. Such systems cover everything from supply-chain management to manufacturing and financial planning. Two of three Cargill systems were implemented around the globe and “work very well,” he said.

But “the third application is the most complex,” Smits said, and Cargill discontinued work on it and had to take an impairment charge on the system’s residual value.

The rest of the one-time charges stem from Cargill’s operations in Venezuela, which devalued its currency earlier this year. Several other multinational companies have taken similar charges. For Cargill, a big supplier of flour, cooking oil and animal feed in Venezuela, the country’s shaky economy has led to charges for two years in a row.