Sunoco Inc. officials thought U.S. Rep. Bob Brady, the city's Democratic Party boss, was blowing smoke when he told them in February that the White House was concerned about the imminent closure of the company's Philadelphia refinery.

But then, at Brady's request, President Obama's top economic adviser, Gene Sperling, organized a conference call with Sunoco chief executive Brian P. MacDonald. Brady and Deputy Energy Secretary Daniel B. Poneman joined the 5:30 p.m. call on March 8.

The officials told the Sunoco chief that the White House was worried about the adverse economic effects of closing the largest refinery in the Northeastern United States. The political implications were unspoken: Pump prices were escalating during an election year, and the president could not afford the loss of 850 refinery jobs.

MacDonald told them about Sunoco's fruitless six-month effort to find a buyer. But he said one outfit might have the muscle to pull off a deal if it were structured right: the Carlyle Group, a Washington private-equity firm.

The March 8 conference call proved to be a pivotal moment in the effort to keep the refinery operating. That effort ended successfully with Monday's announcement that Carlyle and Sunoco will run the 330,000-barrel-a-day plant as a joint venture called Philadelphia Energy Solutions.

As soon as the conference call was over, MacDonald said, he left a message on the cell phone of Carlyle managing director Rodney S. Cohen, who, in a previous role with Pegasus Capital Advisors, had turned around a troubled refinery in Coffeyville, Kan., for a hefty profit.

The same evening, White House officials called their contacts at Carlyle to urge them to talk to Sunoco. Sperling and David M. Marchick, Carlyle's managing director for external affairs, had both worked in the Clinton administration.

Brady, once he had established his credibility with Sunoco, pledged his support to MacDonald.

"I told him, 'I will be your champion,' " Brady said. " 'I will set all these things up, connect you to the major players, if you are committed to doing this.' "

The Hail Mary marriage of Sunoco and Carlyle Group owes much of its success to the unusual cooperation among the Democratic White House, Republican Gov. Corbett, Democrat Mayor Nutter, and Brady, one of the most liberal members of Congress. They were joined by Sunoco, Carlyle and the United Steelworkers, which represents refinery workers.

"This is a rare example of federal, state and local officials, business and labor, Republicans and Democrats, all coming together for one common purpose," said Marchick, Carlyle's chief lobbyist.

The players pledged to keep the process confidential, with the understanding that it would become public if successful. There was an unspoken prohibition on grandstanding.

"You never saw me at a press conference," Brady said. "You never saw me in the newspaper."

Corbett, in an interview, said he understood that rivals would get to share the credit if the deal went through. From his perspective, keeping the refinery operating was a winner – saving jobs and advancing his vision of Pennsylvania as the nation's "energy capital."

"Obviously, if you take it from a political perspective, this is important to the White House. They're going to be able to count this in an election year. . . . Working together and getting this done was a lot better than seeing this facility shut down."

Corbett said he and Sperling, the director of the White House National Economic Council, agreed to do everything within the law to clear a path for the deal. "I think that's unprecedented bipartisan cooperation," he said.

Philadelphia-based Sunoco, desperate to exit the volatile refining business, was willing to turn over its unsellable asset in exchange for a one-third stake in the venture. By forgoing the cash it could get in an immediate fire sale, Sunoco would share in any upside if Carlyle were able to turn the refinery around.

Carlyle, for an undisclosed investment in the refinery operations, gets control of an underused 1,400-acre industrial site with established infrastructure – a place where it can build businesses to exploit new domestic oil and gas production from hydraulic fracturing of shale formations.

In the atmosphere of urgency about a possible closure – Sunoco had said it would shut the refinery this summer if the plant were unsold – the new venture was able to receive some sweeteners that might not have been available to Sunoco alone.

Carlyle will receive $25 million in state aid to match its $200 million investment in refinery upgrades. Federal and state officials agreed to modify a consent order to relax emissions limits for several years to allow the refinery to install new equipment.

Harrisburg and City Hall pledged to support future Keystone Opportunity Zone tax benefits.

Labor leaders had mobilized to mount pressure on elected officials to take action, but Brady said he kept the Steelworkers grounded as the deal progressed.

"I kept the union quieted down so they don't go crazy, don't do anything crazy," he said.

Corbett struck up a rapport with MacDonald, who had taken over as Sunoco's chief only a week before the White House conference call. MacDonald was introduced to Corbett by Charles G. Kopp, chairman of the Philadelphia Regional Port Authority, the governor's point man in Southeastern Pennsylvania.

Corbett said he also established a friendship with Leo W. Gerard, international president of the Steelworkers, the Pittsburgh-based union with 850,000 members.

"I can't understate Leo Gerard's willingness to work on this," the governor said. The union agreed to some concessions in a new contract for its 600 members, who approved it Monday night.

Deputy Mayor Alan Greenberger was Nutter's representative in the negotiations, along with John Grady, president of the Philadelphia Industrial Development Corp.

Greenberger said some issues remained. But City Hall now has established trust with the Carlyle-led venture, now the owner of one of Philadelphia's biggest businesses.

"They need to feel confidence that there's a working relationship that can lead to productive discussions," Greenberger said. "And we need to feel like they're treating us straight. There's a good working relationship here."