Philadelphia Energy Solutions' refinery suffered a massive explosion and fire in the early morning of June 21. (Fortunately, there were only a handful of minor injuries.) Last week, the company -- which filed for bankruptcy last year and has continued to face financial difficulties -- announced that it will not repair and reopen the South Philadelphia facility.

This marks a sudden end for the largest oil refinery in the Northeast. But it's good news for Delta Air Lines (NYSE:DAL), which owns one of the few remaining refineries in the region. (Several others have closed over the past decade.) While other airlines could face higher jet fuel prices due to the loss of refinery capacity, Delta's Monroe Energy subsidiary could see a nice uptick in profits from higher refining margins.

Delta's unusual investment

Seven years ago, Delta shocked observers by buying a refinery in Trainer, Pennsylvania, that had recently been shuttered by Phillips 66. Delta's total investment was around $250 million: $150 million after government incentives to buy the refinery, plus $100 million for upgrades.

Many pundits doubted that an airline could successfully operate a refinery that struggled as part of a major refining company. However, Delta's management saw the deal as a cheap, relatively low-risk way to protect itself against swings in refining margins that can drive up the price of jet fuel at times.

The Trainer refinery has had a mixed track record under Delta's ownership. Changes in the structure of the oil market and rising environmental compliance costs have made the refinery less profitable than the airline had projected. (Back in 2012, Delta said the refinery would earn $300 million annually. It nearly hit that figure in 2015, but hasn't come close since.)

On the other hand, owning the refinery has insulated Delta from elevated refining margins during periods of disruption, such as after Hurricane Harvey in late 2017. The refinery posted operating income of $110 million in 2017 and $58 million in 2018, before swinging to a $34 million loss in the first quarter of 2019.

The refinery's economics just improved

East Coast refining margins jumped by several cents following the explosion at the Philadelphia Energy Solutions refinery. While there is plenty of infrastructure to move more refined products to the Northeast by pipeline and ship, the uptick in refining margins in the region is unlikely to disappear completely anytime soon.

Furthermore, Philadelphia Energy Solutions' refinery lacked the capability to blend biofuels into its products, forcing it to buy renewable credits instead. Delta's Trainer facility is in the same position. With Philadelphia Energy Solutions shutting down, Delta's Monroe Energy unit will face less competition for buying these renewable credits, which should reduce its costs.

The Trainer refinery processes about 185,000 barrels of oil per day. That works out to nearly 3 billion gallons annually. Thus, an increase in refining margins of as little as $0.04 per gallon would boost the refinery's annual operating profit by more than $100 million, a significant sum.

Will this help Delta find a partner?

Since last fall, Delta has been looking for a strategic partner to buy a stake in the Trainer refinery. Given that it only needs jet fuel for its airline business -- not all of the other products the refinery produces -- finding a partner to deal with the rest of the refinery's output would make sense.

So far, Delta hasn't been able to close a deal. The company has even explored selling the refinery entirely, according to Reuters -- although executives have disputed that report.

Regardless of whether a sale or a joint venture is the ultimate goal, the Philadelphia Energy Solutions refinery closure will help Delta. Potential partners (or buyers) that may have been nervous about the Trainer facility's economics may be willing to take another look now, due to the more favorable competitive landscape. Despite the refinery's ups and downs over the years, Delta's bold move to enter the refining business is still on track to pay off in the long run.