SAO PAULO (AP) — In its worst performance for 25 years, the Brazilian economy shrank by nearly 4 percent in 2015, according to official figures published on Thursday.

The IBGE statistics bureau said gross domestic product contracted by 3.8 percent as the country suffered low commodity prices, rising inflation and high interest rates.

Industrial output fell 6.2 percent and services contracted 2.7 percent, with only the agricultural sector posting at least weak growth of 1.8 percent, the lowest level since 2012.

The declining value of the Brazilian real, which fell by almost 50 percent against the dollar last year, helped to boost exports by 6.1 percent while imports of goods and services fell by 14.1 percent.

"The situation would have been even worse had it not been for the currency," said Virene Matesco, a professor at the Fundacao Getulio Vargas, a top Brazilian university. "But the steep drop in the imports of machinery and equipment is a major worry."

Last year also saw investment plans slashed by 14 percent and the dismissal of more than 1 million workers.

"The fall in investment is extremely bad. When you stop investing, you start compromising the future of the country," Matesco said.

Though external factors such as China's slowdown and the fall in the prices of commodities have played a part in Brazil's dismal economic performance, a political crisis has exacerbated the situation. President Dilma Rousseff faces impeachment proceedings in a hostile congress over claims she used public banks to plug gaps in the budget.

"The economy is like a car that is stuck in the mud," Matesco said. "Congress is supposed to be the tractor, but the tractor is broken."

The figure released Thursday is the worst since 1990, when GDP contracted by 4.3 percent.

GDP in 2015 came to $1.5 trillion while per capita GDP was $7,400 — 4.6 percent less than in 2014.