This item has been corrected.

When American Airlines declared bankruptcy in 2011, it was not uncontroversial. With $4.1 billion in cash, American wasn’t exactly a poster-child for insolvency. Its unions opposed the plan, but perhaps less obviously, so did former CEO Gerard Arpey, who left the company without a severance package over his opposition to the move.

But new CEO Tom Horton saw bankruptcy, which rejuvenated the other major American air carriers, as a “car wash” that would scrape away legacy costs, pension obligations, labor costs and old leases. It’s perhaps not surprising that one labor source referred to the employees’ relationship with management as a “fifteen-year running gun battle,” which became most apparent during last fall’s pilot sick-outs.

After bankruptcy began, a merger with US Airways was the most obvious way to improve the problem underlying American’s losses: it was competing with bigger airlines, the product of other recent mergers (United-Continental, and Delta-Northwest). But management wanted to wait until after bankruptcy—in part because airline executives are typically awarded 8-10% of the company’s equity on an exit from bankruptcy.

That’s when the three labor unions representing American’s pilots, mechanics and other ground crew, and flight attendants, took the unusual step of negotiating alternate labor agreements in secret meetings with US Airways and its CEO Doug Parker last year.

“Within two weeks were able to negotiate what we couldn’t do in six years with American Airlines, and that was a contract,” Tom Hoban, an American pilot who is a spokesperson for the Allied Pilots Association, says.

The contracts, which would take effect in the event of a merger occurring during bankruptcy, weren’t incredibly generous—a pension freeze and buyouts were involved—but they did include pay raises, which the unions secured from US Airways in return for bringing American’s employees on board.

“Doug Parker in particular really wanted the merger with American and had an interesting strategy in courting the unions, said he learned from his failures in past merger attempts,” Jamie Horwitz, a spokesperson for the Transit Workers of America, says. “This has been different than some past bankruptcies, we’ve been able to lessen the job loss and get some raises moving forward.”

The deals showed American’s creditors that Parker wouldn’t repeat the failure of his 2005 merger attempt with Delta, which ended when Parker was unable to come to terms with employees. They also helped force American to come to the table to sign its own new contracts with the unions—the last of them, with the pilots, in December—which would take effect outside of bankruptcy. The two sets of contracts offered a comparison for American’s creditors to assess the costs and benefits of a merger with US Airways, and, according to Hoban, “the value that a combined carrier represents is far greater than the cost of a joint pilot contract.”

Hoban also says that the pilots’ union will secure a 14% equity stake in the new company after the merger, the largest single share. But equally important are new faces at the top of the company: It is Parker, the head of the smaller firm, rather than American’s Horton, who is likely to be named boss of the new combined airline. ”What we want is a fresh management team that’s going to remedy the problems, improve the coprorate culture here, serve our customers in the manner that they deserve,” Hoban says.

Indeed, sources tell CBS news of fears that keeping Horton on will result in more delays like those experienced during last fall’s labor strife.

Correction (2/7/13): An earlier version of this article incorrectly reported that a union contract with US Airways would save $570 million compared to a contract with American Airlines. However, the labor costs of a merged airline would be higher than American’s alone because it includes US Airways’ existing pilots. We removed the $570 million figure and instead inserted Hoban’s observation that American’s creditors saw greater value in a combined carrier despite these higher labor costs.