(Reuters) - Ally Financial Inc's Residential Capital unit is nearing a bankruptcy filing, sources familiar with the situation said on Sunday, in a move that could help the taxpayer-owned auto lender shed its troubled mortgage business but also spur drawn-out legal fights.

The board of ResCap is scheduled to meet later on Sunday and a pre-arranged bankruptcy filing, where Ally has the support of some creditors to its plan but not all, is expected to follow soon after, the sources said.

Under the plan, Fortress Investment Group (FIG.N) is expected to make an opening bid of more than $2 billion, including debt, to buy certain ResCap assets, while Ally would buy the rest, in a bid to turn all ResCap assets into cash, a source said.

Barclays Plc (BARC.L) on its own is arranging a $1.45 billion debtor-in-possession financing for operations during the bankruptcy, sources have said. A big chunk of that facility is expected to be sold to investors by the time it is announced, a source said.

Ally spokeswoman Gina Proia and Fortress spokesman Gordon Runte declined to comment. Barclays was not immediately available for a comment on Sunday, but had earlier declined to comment on the DIP loan.

Ally, the former lending arm of General Motors Corp (GM.N), has been besieged in the past few years by losses in its Residential Capital mortgage unit, which was once a major subprime lender and profit engine.

A bankruptcy of ResCap would clear the path for Ally, formerly known as GMAC, to focus on its main auto lending business and to put together a plan to pay back U.S. taxpayers. The U.S. Treasury injected $17 billion into the lender during the financial crisis and now owns nearly 74 percent of the company. Ally owes the government about $12 billion, counting dividend payments by the lender and sale of some securities by the Treasury.

The filling would come as pressure increases on Ally to repay that money and problems at ResCap become increasingly unmanageable, sources have said. The Obama administration is trying to show recoveries from crisis-era bailouts before the presidential election in November, and government officials are loath to let Ally become a black mark on the auto industry restructuring.

In filing for bankruptcy, ResCap would also become a rare example of a subsidiary of a bank holding company to do so. As a result, other banks with intractable mortgage problems, such as Bank of America Corp (BAC.N), would be closely watching how the company deals with regulators and creditors and manages the bankruptcy process.

Ally is the fifth-largest mortgage servicer in the United States and the country's 10th largest originator of home loans, according to the latest data from Inside Mortgage Finance. All of Ally's mortgage servicing -- the collecting of payments and the handling of defaults -- falls under GMAC Mortgage, which is a subsidiary of ResCap.

DETAILS IN THE FILING

Last week, sources said Ally had reached general agreement with ResCap bondholders to speed up the bankruptcy process and make it less contentious.

The company had been negotiating with bondholders who hold more than 45 percent of junior secured notes at ResCap. Billionaire Warren Buffett's Berkshire Hathaway (BRKa.N) holds another 45 percent of the junior secured notes and holds a significant portion of ResCap's unsecured notes that mature in May, sources have said previously.

ResCap's bankruptcy could still be litigious. The company faces more than 20 lawsuits from individual states related to mortgage-backed securities and at least one other suit from regulators. In addition, there is also the possibility that ResCap creditors may file a fraudulent conveyance lawsuit about an asset that was transferred from ResCap to Ally. Another potential legal tussle could emerge if creditors decide to reach beyond ResCap to Ally Financial for assets.

Ally has said a ResCap bankruptcy filing could lead to significant charges and lawsuits. It has said it estimates that losses at the time of a filing could range from $400 million to $1.25 billion.

A key issue for Ally in a ResCap bankruptcy will be whether the mortgage unit is considered to be a separate entity, protecting the parent from its subsidiary's liabilities. Management is confident that ResCap is considered distinct because it has its own board with independent members and uses its own advisers for transactions with its parent, a person close to the company has said.

Tom Marano, a former Cerberus Capital Management and Bear Stearns & Co executive, has served as chairman and CEO of ResCap since 2008. ResCap has a seven-member board, including four independent directors.

The unit still faces unknown claims related to mortgage-backed securities sold to investors. In a filing in April, Ally said ResCap could face liabilities of up to $4 billion, which the mortgage unit would have limited ability to pay.

Ally has tried to get rid of ResCap several times over the last few years.

In 2009, for example, the company debated bankruptcy but then-CEO Alvaro de Molina deemed the move too risky. Current CEO Michael Carpenter, a former Citigroup Inc (C.N) executive who replaced de Molina in November 2009, tried to sell ResCap in 2010, but bidders wanted Ally to retain the mortgage unit's liabilities.

In the meantime, problems for the mortgage industry have mounted. In autumn 2010, Ally became the first lender to report problems with its handling of foreclosure documents, leading to a $25 billion settlement this year with Ally and four other lenders over so-called robo-signing. Lawsuits over mortgage-backed securities have also piled up.

Ally does not have publicly traded shares, but has stockholders. Besides the U.S. Treasury, a trust for GM holds 9.9 percent and Cerberus owns 8.7 percent.

Cerberus led a consortium that took a majority stake in GMAC in 2006, but its investment was winnowed by the government bailouts.

(Reporting By Rick Rothacker, Soyoung Kim and Paritosh Bansal; additional reporting by Caroline Humer; Editing by Maureen Bavdek)