General Motors Co has secured a $5 billion credit facility, two people briefed on the bank deal said on Wednesday, marking the return of the top U.S. automaker to the capital markets a year after it emerged from a landmark bankruptcy.

GM now plans to file a registration for its IPO on Friday, a day after it reports what is expected to be its second consecutive quarterly profit, two people with direct knowledge of the process said.

By securing the bank credit, GM cleared a hurdle toward an initial public offering of stock expected to make the U.S. government a minority shareholder and hand the Obama administration an important political win against critics of its $50 billion bailout of the automaker.

GM, now 61 percent-owned by the U.S. government, is counting on the momentum from its improved profitability and better global auto sales to build investor interest for a stock sale that will mark the return of a one-time blue chip to the ranks of listed companies.

The GM IPO, expected to be the largest ever for the U.S. market and an unprecedented privatization of an American industrial icon, is likely before the U.S. Thanksgiving holiday, one of the sources said.

White House auto task force chief Ron Bloom and GM executives have said they expect an offering before the end of the year but have denied that the timing would be tied in any way to early November Congressional elections.

GM Chief Executive Ed Whitacre said last week that he would participate in a roadshow intended to drum up investor interest in the stock offering in the coming weeks.

Chief Financial Officer Chris Liddell, who joined GM from Microsoft Corp earlier this year, has been the point person on the automaker's outreach to potential creditors and investors, people involved in the process have said.

GM had no comment. A U.S. Treasury spokesman declined to comment.

The automaker and White House officials have repeatedly said that they expect to complete a stock offering by year's end.

The now-completed GM credit facility includes tiered levels of commitments from Wall Street's largest banks, one of the sources said.

At the upper level, major U.S. banks including Bank of America Corp, Citigroup Inc, Goldman Sachs Group Inc, JPMorgan Chase & Co and Morgan Stanley have each committed $500 million, the source said.

GM will use the revolving credit facility to fund its operating needs.

Separately, the U.S. automaker is on the verge of filing for an IPO expected to be the biggest U.S. IPO since Visa Inc's $19.7 billion offering in March 2008.

GM is due to report quarterly results on Thursday morning.

GM was bailed out with $50 billion in U.S. government funding that allowed it to restructure in bankruptcy. It has paid back $7 billion.

GM executives have said that they wanted to reestablish the company with Wall Street by first securing a revolving credit facility with banks before targeting a larger pool of investors for a stock offering.

In its IPO filing GM will indicate a nominal amount of equity to be offered in order to file the necessary paperwork with the U.S. Securities and Exchange Commission, one of the sources said.

In practice, GM and its financial advisors are likely to start to try to sell about $10 billion in equity and then work toward a higher figure depending on investor interest and market conditions, the person involved in the process said.

Ultimately, the amount to be sold in the IPO is likely to represent at least a quarter of the company's equity, the person said.

The U.S. Treasury plans to offer shares in the same proportion as other holders, including the government of Canada, the province of Ontario and a health care trust aligned with the United Auto Works Union, sources have said.

That could leave the U.S. government with a minority stake in the automaker and allow GM to distance itself from the label Government Motors.

The Obama administration has been consulted as preparation for the IPO has proceeded, the person said.