Brazil has experienced a fair share of growing pains in the last several years, as might be expected for a quickly growing economy and democracy. A historic recession tightened its grip on the country just as a massive corruption scandal, which eventually led to the impeachment of its president, hung overhead.

The state-owned energy giant Petrobras (NYSE:PBR) was at the center of the scandal in which executives and government officials received bribes to broker deals that saw the company award inflated contracts to construction companies. The money-laundering scheme is estimated to have included nearly $9 billion in illegally transferred funds.

Petrobras stock hit a 13-year low in early 2016 as institutional investors continued their multi-year exodus out of the stock, but shares gradually recovered throughout the year as offenders were brought to justice, and more importantly, management's efforts to scrub a toxic balance sheet showed tremendous signs of progress. "Gradually" may be putting it lightly. While the bar was low, the stock ended the year riding 137% gains. Image source: Getty Images.

Although plans to deleverage the balance sheet and increase cash flow will actually accelerate this year, headwinds in the company's deepwater investments could slow the stock's recovery. What's ahead for Petrobras stock in 2017?

2016: Turning the page on debt

The single biggest problem for Petrobras last year, financially speaking, was simple: an enormous debt load. The company has kept pace with large multinational peers in terms of capital expenditures over the years to remain competitive, but has two to three times the debt. Consider the debt balances for some of the world's largest oil companies as of the end of September 2016:

Source: Google Finance.

There are good reasons for Petrobras' affinity for debt, which peaked at $162 billion in the third quarter of 2015. For instance, there are inefficiencies and excesses accompanied by the state-owned model, and the company had to race to bring Brazilian infrastructure up to post-industrial economy standards in a compressed timeline compared to peers. No matter the excuse, debt has been a huge burden for investors: The company paid $6.3 billion in interest expenses in 2015.

The good news is that the company is executing a plan to decrease debt by selling off non-core assets, which will have the added benefit of lowering operating costs and refocusing the company on growth opportunities. The strategy saw a combined $13.6 billion in divestments and strategic partnerships in 2015 and 2016, and a more than $40 billion reduction in debt.

Things will only get better from here: Petrobras plans to bring in $21 billion this year and next using a similar strategy and decrease its net debt-to-assets ratio to 2.5 times by the end of 2018. For reference, the metric peaked at 5.3 times in 2015.

Early progress tackling monstrous debt loads pushed the stock higher last year. Investors were right to be optimistic: Although it seems likely that Petrobras will have more debt than most of its peers, even when it achieves internal debt reduction goals in 2018, the company may find itself in an advantageous position when it comes to cash flow from operations and cash on hand.

Petrobras has essentially maintained its previous levels of cash flow during the recent downturn -- something most major oil companies cannot boast. The scary part is that drastic reductions in debt, bringing with it the potential to spend billions less in annual interest payments, and lower annual operating expenses from refocused business segments mean the company could increase its annual operating flows when oil prices recover. That could allow the dividend to be reinstated within the next two to three years.

The stock seems poised for gains in the near future should management successfully execute against the strategic plan already in place, but that opens the door to criticisms about where Petrobras plans to turn its attention.

There are already internal debates about whether or not Petrobras should divest its refining assets. It seems likely that the company will opt to maintain a majority interest and sell off stakes to multinational peers. That way, it can remain a vertically integrated oil company and take advantage of trends in Brazilian energy consumption that favor oil and natural gas. The company does plan to move out of petrochemicals and liquefied petroleum gas distribution industries, however, to focus solely on oil and gas. PBR data by YCharts.

Therein lies a potential problem for investors. The state-owned energy giant is salivating over the Lula oil field, a large and virtually untapped offshore resource discovered by Petrobras in 2006. There's also the Jupiter field, an offshore natural gas deposit of equal size and adjacent to the oil field, which was discovered in 2008.

The good news is there's an estimated 8 billion to 30 billion barrels of oil in Lula. The bad news is that extracting it is a bit of a technical nightmare. It sits under 2 kilometers of water and another 5 kilometers of salt deposits. In other words, fully developing the field will likely be a little beyond Petrobras' expertise or financial reach. What's more, the oil produced may be too costly to be competitive at current crude oil prices.

A decision by Brazil's government to open up Lula development to international oil companies will help expedite the process and reduce the direct risks shouldered by Petrobras, but failure to profitably develop the deposit could stymie the company's plans to boost oil output by 700,000 barrels per day between now and 2021.

What does it mean for investors?

At a market cap of less than $70 billion, Petrobras is historically cheap. It seems possible that "simply" executing against the strategic plan to reduce debt levels will allow the stock to rise in 2017 and 2018, while the potential for rising oil prices can provide additional support for shares. The latter will prove critical for Petrobras' plan to develop Lula and turn it into a profitable asset.

While it's too soon to know how the company's deepwater ambitions will fare, a significantly stronger balance sheet will provide ample financial flexibility, no matter the outcome.
[null, null, null, {"document_url": "https://www.fool.com/investing/2017/02/10/petrobras-gained-137-in-2016-is-there-room-to-run.aspx", "unformatted_src": "https://media.ycharts.com/charts/50fa0edec658b327e13ea7f8c8b9202c.png", "src": "https://media.ycharts.com/charts/50fa0edec658b327e13ea7f8c8b9202c.png", "formatted_filename": "fa edec b e ea f c b c", "alt_text": "PBR Chart"}, null, null, null]