Mexico's state-owned oil company is drowning in a sea of cheap oil.

Pemex, as the oil giant is known, is suffering from a steep decline in production that has been exacerbated by the crash in crude. Years of losses have left Pemex with huge unfunded pension liabilities and on the hook for billions to suppliers.

Things are so bad that this week the Mexican government had to come to the rescue with $4.4 billion in aid for its former cash cow. More financial assistance could be needed soon. That's not good considering the government relies on Pemex to pay for about a fifth of its budget.

"This is just papering over the cracks considering Pemex's problems," said Edward Glossop, emerging markets economist at Capital Economics. "Pemex's struggles have been very negative for Mexico's public finances."

Earlier this year Mexico was forced to slash government spending by $10.1 billion, or about 0.7% of the country's GDP. The Ministry of Finance said the cuts would focus on areas of spending "without a high economic and social impact."

The new aid for Pemex calls into question whether those spending cuts are deep enough to balance Mexico's budget.

"It could mean the government needs to announce more fiscal austerity measures to bring the deficit under control," said Glossop.

Related: Argentina wins big victory to end 15 years in default

Like public and private oil companies around the world, Pemex is grappling with a dramatically different environment today than just a few years ago. Oil prices have crashed to as low as $26 a barrel in February, compared with over $100 in mid-2014. Cheap oil makes it very hard to turn a profit on the expensive drilling projects Pemex is known for in the deep waters of the Gulf of Mexico.

Pemex is also grappling with years of under investment from the government. Its oil production totaled 2.27 million barrels per day last year, down by nearly 7% from the year before.

Now the state-owned oil company is under serious financial stress, forcing it to cut jobs and slash spending. Pemex lost nearly $10 billion in the final three months of 2015 alone.

Pemex admitted it was facing a "liquidity problem" due to the "difficult situation of global low oil prices."

Related: U.S. Gulf of Mexico producers pumping oil like never before

Mexico's government is giving Pemex $1.5 billion to right the ship in addition to $2.7 billion to pay for worker pensions. Analysts think this aid is only the beginning.

Thankfully Mexico's overall economy doesn't rely on the oil industry quite as much as it used to. Petroleum now makes up about 5% of total exports, compared with about one-third in 1990, according to Brown Brothers Harriman.

"The good news is that Mexico is one of the few oil producers that has actually diversified," said Win Thin, emerging markets currency strategist at Brown Brothers.

Still, the oil crash has dealt a big blow to Mexico's efforts to end Pemex's monopoly on the Mexican oil business. Reforms passed in 2013 under President Enrique Pena Nieto tried to encourage private investment, but little new production has come of it so far.

"It just happened that Mexico decided to open up its energy sector at the worst possible time," said Glossop.