Correction: An earlier version of this story incorrectly said that the Carlyle Group is based in Alexandria, Va. It is based in Washington. It also mistakenly said that David Albert is a co-head of Carlyle’s equity opportunity fund. He is the co-head of a different Carlyle fund for energy. This version has been updated.

The Schuylkill River borders the Philadelphia Energy Solutions refinery, Nov. 15, 2012 in Philadelphia, Pa. The rescue of the refinery is a political tale as well as a business one. (Ricky Carioti/The Washington Post)

Phil Rinaldi looked out the window of a company car at the sprawling oil refinery that straddles the Schuykill River. The property covers an area nearly twice the size of New York City’s Central Park, and it is home to clusters of pipes, processing towers and storage tanks along with big stretches of empty dirt.

The site, situated next to a baseball field, is what Rinaldi calls his own “field of dreams” where he hopes to build a high-speed railroad terminal to unload shale oil and a power plant that would run on shale gas. And he believes that both of those will lure new industrial companies here to help build up what the oil company Sunoco had until recently planned to close down.

“We want to make this a destination,” Rinaldi said.

Rinaldi is working for Carlyle Group, the Washington-based private equity firm that earlier this year acquired about a two-thirds interest in this imperiled oil refinery, whose history dates to 1866. The day after Labor Day 2011, Sunoco had announced it would shut down the plant as part of a strategy to exit its refining business, where the company had lost about $800 million over three years.

What did Carlyle see? Opportunity, said Rinaldi, and a chance to turn it around by tapping energy resources that even a year earlier weren’t readily available: cheap Pennsylvania shale gas and growing supplies of North Dakota shale oil. The private equity firm’s commitment to invest and pursue those supplies has saved about 850 jobs at the south Philadelphia refinery and transform it into a hub of rejuvenated industry.

“So far everybody’s happy,” said Jim Savage, president of the United Steelworkers local 10-1. “The alternative was the death penalty.”

The rescue of the refinery is a political tale as well as a business one. For weeks, the USW’s Savage knocked on the doors of members of Congress. The local congressman, Rep. Bob Brady (D-Pa.), lobbied Sunoco executives and the White House to save jobs.

In the middle of the presidential campaign, his call did not fall on deaf ears. White House economic adviser Gene Sperling urged Sunoco to find a way to keep the plant open and prevent a big loss of gasoline supplies for the northeast. The Environmental Protection Agency made a deal that will allow Carlyle to expand the plant without having to go through the demanding, public and time-consuming process known as new source review.

Several months later, the dealmakers seem happy. The joint venture recently asked a contractor to train 84 new workers. On Dec. 8, the USW celebrated at Philadelphia’s IATSE ballroom with dinner and dancing to the music of a local band, the Urban Guerrilla Orchestra. The group also gave Brady the first Bob Brady Working Class Hero Award.

“Just as Rocky Balboa is known as a mythical Philadelphia hero for fighting against all odds, Bob Brady is a true hero for fighting to preserve jobs, lives and livelihoods,” said Carlyle managing director David Marchick in a letter read at the event.

Falling behind in the shale revolution

New trends in the oil business had threatened to shut down Sunoco’s 330,000-barrel-a-day-Philadelphia refinery. Sunoco relied heavily on relatively expensive light sweet crude oil — which is low in sulfur and relatively easy to refine into gasoline and heating oil.

That had become a big disadvantage. The surge in U.S. oil supplies derived from shale and the pipeline bottleneck in the hub at Cushing, Okla., had driven down the price of the U.S. benchmark crude, West Texas Intermediate used by many Midwest and Gulf Coast refiners. But the Philadelphia refinery imported oil primarily from West and North Africa that is linked to the much higher London benchmark, Brent crude. The gap between the benchmarks is about $23 a barrel.

Meanwhile, the ability to crank up prices to motorists had ebbed. According to an open letter from Sunoco chief executive Brian P. MacDonald published in March in the Philadelphia Inquirer, the demand for gasoline on the East Coast had declined 12 percent since 2007 and is expected to fall further.

MacDonald also pointed to overcapacity in the refining industry. “With our losses projected to continue, the threat to the company was so grave that we were forced to make a very difficult choice,” MacDonald said in the ad.

The ad didn’t tell the whole story. Sunoco was telling investors that it could boost its lackluster stock price by shedding all five of its refineries, exiting that cyclical business. The remaining business would consist of 4,700 gas stations and a pipeline, which had been set up as a master limited partnership with certain tax advantages. Sunoco owns 34 percent interest of the partnership, which produces steady, predictable profits. The restructuring would make Sunoco takeover bait, and indeed the company was later sold to Dallas-based Energy Transfer Partners, a pipeline operator.

Sunoco “could be a more appropriate acquisition target for a master limited partnership once the refineries are idled,” said a Sept. 8, 2011, report by Citigroup analyst Faisel Khan.

Sunoco retained Credit Suisse to sell the Philadelphia refinery and says that the firm contacted more than 150 potential buyers, without luck. Carlyle was one of those.

Becoming the middle man

As the deadline for closure approached, the political pressure grew. Jobs were at stake. But there was another worry. Sunoco, which planned to close its Marcus Hook, Pa., refinery too, was knocking a total of 505,000 barrels a day of capacity out of the market. Conoco Phillips decided to sell or close a refinery in Trainer, Pa. And a joint venture led by Hess, after losing $1.3 billion in three years, shut down a giant refinery in the U.S. Virgin Island St. Croix that once served the East Coast market. Analysts were predicting substantial price increases just as the summer driving season was kicking in — in an election year.

Savage was desperate. “We visited every senator from Maryland to Maine,” he said. “Plus if some senator from New Mexico or Colorado was on a related committee, we met with them, too.” He noted that the northeast uses 75 percent of the country’s heating oil and that half of that was produced at the three Pennsylvania refineries.

Sunoco had a new chief executive, MacDonald, who went to Washington to meet Brady. The first session didn’t go well. MacDonald said the refinery site could be turned into a storage depot with about 10 jobs and suggested that Brady might want to attend a media event highlighting that. Brady was angered.

“I said, ‘I don’t appreciate that and I don’t appreciate this conversation.’ I didn’t feel they had turned over every stone. I said, ‘You have buyers, but it looks to me that there isn’t a seller.’ ”

Within a day or two, MacDonald was back and said he would do everything possible to keep the plant open. Brady became a middle man between Sunoco, Carlyle and the Obama administration.

‘Make the asset sing’

Carlyle took another look. Things were changing in the oil and gas business and Carlyle’s dealmakers thought Sunoco hadn’t realized just how valuable the refinery could be. In September 2011, Citigroup analyst Khan had said that the refinery needed to switch to cheaper domestic crude. However, he wrote then, “this would require a pipeline solution, which we do not have visibility on today.”

But more and more crude oil was leaving the rich Bakken formation in North Dakota by rail. Overall, the nation is transporting more than 1 million barrels a day by rail. And that Bakken crude could travel on the BNSF lines to Chicago, switch to CSX’s network and be delivered right to south Philadelphia. Because cheap new shale gas is replacing coal used by electric power plants, railroads are carrying less coal and looking for new business.

CSX, which delivers to the Philadelphia refinery, reported in its most recent earnings report that coal shipments in 2012 were down 16 percent from the year before.

Union Pacific doesn’t ship oil from the Bakken, but it is typical of trends in the rail business. In 2010, crude oil accounted for about 4,400 carloads, company spokesman Tom Lange said. In 2011, it was 25,000 carloads. In 2012, he said, oil could reach 140,000 carloads, or about 90 million barrels of crude — all of it from shale oil formations.

Access to cheaper U.S. crude would “change the business model,” said Rinaldi, a refining and fertilizer industry veteran who helped turn around a poorly performing refinery in Coffeyville, Kan., a decade ago.

Rinaldi said in September that Bakken crude would account for nearly 50,000 barrels a day of the refinery’s supplies. Those cheaper supplies are already pushing down the price of West African crude, Rinaldi added.

Even bigger amounts of Bakken oil could arrive if the refinery builds a high-speed facility, which Rinaldi said could unload two 120-car trains a day, each carrying more than 70,000 barrels, while storing a third train on the refinery site. Because of the speed of the facility, CSX would leave its engines in the refinery yards, adding to the pace of operations and giving the refinery greater control.

North Dakota producers would continue looking east, Rinaldi said, because production was soaring and the Texas gulf coast refiners have the facilities to use lower quality crude.

“This is what we do,” Carlyle’s Marchick said. “We put some equity in and make the asset sing.”

Many analysts think carrying oil by rail is a throwback or temporary solution while pipelines get built. But Carlyle saw rail as an advantage. “You’d be shocked. A very big piece of the country is filled with rail. It doesn’t come in a straight shot, but there is a lot more track than you think,” said Rodney Cohen, co-head of Carlyle’s equity opportunity fund in New York.

Supplying the refinery by rail could provide flexibility on purchases, said Cohen, who at his previous firm, Pegasus, worked closely with Rinaldi on the Coffeyville refinery. “Pipelines are largely point-to-point systems,” he said. “With rail, the Utica shale pops up [in Ohio], and no one is going to build a pipeline to the Utica shale tomorrow. But rail has flexibility.”

No other refinery on the East Coast would have “anywhere near that capacity,” Rinaldi said. After other refinery closures, Rinaldi said, the Philadelphia refinery was now the largest from Florida to Nova Scotia with a 25 percent market share.

Moreover, oil refineries are very energy-intensive, and natural gas is by far the biggest operating expense aside from the crude oil itself. Unlike the refineries in the Caribbean that used to provide most of the gasoline to the East Coast, the Philadelphia refinery now has access to cheap natural gas. There isn’t a pipeline directly from the giant Marcellus shale formation in other parts of Pennsylvania, but three or four firms are vying to build one and prices nationwide have fallen. The now-closed Caribbean refineries burned oil that was at least five times as costly.

Indeed, the cheap natural gas is ample enough not only to feed the refinery, but to supply a new 600- to 700-megawatt power plant and facilities such as a natural gas-based hydrogen plant, which would make cleaner fuels and building blocks for fertilizers.

The refinery itself was in good shape. Sunoco had spent about $700 million on it in recent years, Rinaldi said.

Cautious help from White House, EPA

While Carlyle was getting closer to sealing a deal with Sunoco, the steelworkers were getting antsy. Savage wanted to launch a boycott of Sunoco’s 4,900 gasoline stations. Brady said wait: “I said, ‘We don’t want to put a stick in anyone’s eye just yet.’ ”

Brady was trying to get Carlyle help from the administration on EPA permits, but the White House was uneasy about being seen as helping a private-equity firm while the Obama campaign was busy lambasting Mitt Romney’s Bain Capital. Brady contacted Vice President Biden and spoke by phone with Sperling, who said he talked to Obama.

“The president was in campaign mode banging on Romney for being a hedge fund guy. And here he was helping a hedge fund,” Brady said. “They didn’t want the publicity.” (Both Bain and Carlyle call themselves “alternative asset managers,” not hedge funds.)

Brady said Pennsylvania’s Republican Gov. Thomas W. Corbett and the White House were also both worried about being blamed by the other if efforts to save the refinery failed.

Meanwhile, the EPA was bending. To avoid public hearings and requirements of new source review, an existing plant making changes had to balance any emission increase with a decrease in another part of the plant. There is a narrow exception that allows an decrease at a plant to offset an increase at another, but these are designed for adjacent facilities that can’t operate without each other.

In the end, the EPA said it would allow the Philadelphia refinery to offset anticipated emission increases at that plant — related to Carlyle’s plans to add facilities — with reductions resulting from the closure of Sunoco’s Marcus Hook refinery.

“There are some big problems with that approach,” said Eric Schaeffer, head of the Environmental Integrity Project and former chief of EPA’s office of civil enforcement.

The Marcus Hook refinery is 17 miles from south Philadelphia “and the two facilities are not interdependent — obviously, since the Philadelphia refinery will keep running after Marcus Hook closes,” Schaeffer said. Moreover, he added, “reducing emissions of pollutants at a plant 17 miles away will not necessarily offset the increases in air pollution in neighborhoods next to plant.”

He said the south Philadelphia expansion plan would “include a pretty substantial boost in fine particulates” and that the city’s air quality already falls short of EPA standards.

Carlyle was also talking to the steelworkers. The USW’s Savage said the company “treated us with dignity at the bargaining table. Quite frankly they didn’t have to. They could have said, ‘This is what we need, go vote on it. The alternative is you’re not going to work.’ ” When the three-year contract was put to a vote, 98.5 percent of the members approved it.

The state also chipped in $15 million for construction and $10 million for the high-speed rail unloading facility — as long as Carlyle invests $140 million and creates at least 30 jobs. Carlyle says it will create about 100 long-term and 1,000 construction jobs.

And on Sept. 19, the new joint venture Philadelphia Energy Solutions was unveiled. Sunoco contributed the existing facility in return for about 30 percent of the venture, while Carlyle owns the rest in return for the capital investments it plans to make.

Carlyle says 15 to 20 industrial companies have expressed interest in taking advantage of the site’s access to natural gas and its location along pipeline and shipping routes.

“We’re looking for the ones that make the most sense,” said David Albert, co-head of a different Carlyle fund for energy. “I’d be very surprised if in the next 18 to 24 months you don’t see us moving into a couple of different businesses in chemicals and agricultural products, such as fertilizers.”

Albert said Carlyle might invest in those ventures or host them on the site and allow other companies to take advantage of the infrastructure.

“What we’re doing is a bit similar to ‘If you build it, they will come,’ ” Rinaldi said.