While other oil and gas industry stocks were celebrating the reversal of their multiyear downward trends, poor master limited partnership Magellan Midstream Partners (NYSE:MMP) was heaving a sigh of relief that its rough 2017 -- in which the pipeline operator's long-term downward trend continued -- was over. 

Indeed, the stock market shaved 6.2% off of Magellan's shares for 2017. That wasn't as bad as the 36.1% haircut given to Plains All American Pipeline (NYSE:PAA), but it was far worse than peers like TransCanada (NYSE:TRP), whose share price rose 7.7%.

Here's how Magellan got off track in 2017...and why 2018 is likely to be better.

The interior of a pipeline

The stock market wasn't kind to shares of Magellan in 2017, but there are signs of light at the end of the...er...pipeline. Image source: Getty Images.

A building year

In a way, Magellan in 2017 was like an underperforming baseball team that trades away some star power for a bench full of promising rookies that it hopes can bring the team to greatness in future seasons. Although it hasn't worked for my Cincinnati Reds, Magellan's "building year" seems more likely to bear fruit.

Magellan's HoustonLink pipeline project -- a joint venture with TransCanada -- cost $70 million but should begin operating in Q1 of this year. It's also made several enhancements to its BridgeTex pipeline in the Permian Basin -- a joint venture with Plains All American Pipeline -- upping its capacity by 25%, and possibly tacking on an additional 10% by early 2019. Magellan also started building the Wink Pipeline in the Delaware Basin of Texas for an estimated cost of $150 million; a $125 million storage project that it plans to start up by the middle of 2018; and in a joint venture with Valero, a new $820 million marine terminal that should be fully operational by early 2019.

These projects should help the company grow earnings and increase its distribution yield to unitholders in 2018 and beyond, but in 2017, they weren't doing anything but costing money. 

Other odds and ends

Various other issues outside of the company's control plagued Magellan during the year, not the least of which was Hurricane Harvey. The storm impacted company facilities in Houston and Corpus Christi, particularly its Galena Park marine facility. Harvey had a $20 million impact on the company, reducing Q3 distributable cash flow by an estimated $10 million.

Meanwhile, oil and gas prices remained low in the first two quarters of 2017. As a pipeline operator, Magellan didn't feel the impact as acutely as oil producers did, but lower prices generally mean less production activity, which translates to less demand for Magellan's pipelines. Luckily, prices rose late in the year, which should help Magellan announce a strong finish to the year when it reports Q4 earnings on Feb. 1. 

Solid fundamentals

In spite of those challenges, Magellan actually had pretty decent performance for the year. The company increased its per-unit quarterly distribution throughout the year, from $0.855/unit in January 2017 to the recently announced $0.92/unit in January 2018, a 7.6% increase. That's ahead of Magellan's initial guidance for the year. 

Meanwhile, Magellan has maintained its top-notch balance sheet. Because energy infrastructure is such a capital-intensive business, many pipeline master limited partnerships carry a lot of debt. Magellan, though, has only $4.3 billion in debt on its books, for a debt-to-equity ratio of 0.26. Compare that to Plains All American, which is carrying $11.4 billion in debt, or TransCanada's eye-popping $35.1 billion in debt, giving both companies a debt-to-equity ratio of 0.74.

That healthy balance sheet should serve Magellan well in 2018 as it looks to grow through acquisitions or additional infrastructure projects.

Looking ahead to 2018

Magellan's rocky year in 2017 may be good for investors in 2018, because it offers an opportunity to buy a growing company with a solid balance sheet before many of its big growth drivers -- the new and expanded infrastructure projects it's bringing online over the next two years -- kick in. That said, Magellan's enterprise value-to-EBITDA ratio -- a valuation metric handy for capital-intensive businesses -- is still higher than its peers', even after a lackluster year.

Nevertheless, I've picked Magellan as one of my top three oil stocks to consider in 2018, and I'm expecting good things from the company over the next couple of years.

John Bromels has no position in any of the stocks mentioned. The Motley Fool recommends Magellan Midstream Partners. The Motley Fool has a disclosure policy.