Countrywide Financial Corp, the largest U.S. mortgage lender, said on Thursday that it had lined up $12 billion of secured financing to help cope with a housing slowdown that has reduced loan demand and will lead to widespread layoffs.

The company's shares rose as much as 9.8 percent in early trading.

Countrywide said it had recently lined up the financing through new or existing credit facilities. Last month, it drew down $11.5 billion from credit facilities because it was unable to sell short-term debt to fund regular operations.

The company also said it had funded $34.4 billion of mortgage loans in August, the fewest this year and down 17.3 percent from a year earlier, as it lost access to capital and tightened lending standards. Its pipeline of unclosed mortgages fell 16.8 percent from July to $51.8 billion.

The company's recent actions to secure additional funding, as well as the migration of funding its originations through the (Countrywide Bank) thrift should substantially address funding concerns, Credit Suisse analyst Moshe Orenbuch wrote. As origination volumes and mortgage pipeline decline over the coming months, we expect the stress on its funding needs should subside significantly.

Countrywide shares were up $1.14, or 6.9 percent, at $17.76 in morning New York Stock Exchange trade after rising as high as $18.25.

Through Wednesday, the stock had fallen 60.8 percent this year as defaults rose, home prices stopped increasing and investors grew unwilling to buy many kinds of home loans.

On Friday, Countrywide said it would fire up to 12,000 employees, or 20 percent of its work force, by December. Analysts said more cuts are possible. Staffing in August fell to 60,867 from July's 61,586, the year's first monthly decline.

FEWER LOANS

Countrywide this summer stopped making home loans that don't meet its own banking unit's investment criteria, or which aren't eligible to be securitized by such entities as Fannie Mae and Freddie Mac.

Less than 4 percent of Countrywide's home loans in August were subprime, or intended for people with weak credit.

Last month, Countrywide received a $2 billion infusion from Bank of America Corp, which could eventually give the second-largest U.S. bank a one-sixth stake in the lender.

On Wednesday, U.S. Treasury Secretary Henry Paulson urged Countrywide Chief Executive Angelo Mozilo and other mortgage officials to help borrowers who took out adjustable-rate loans whose rates are resetting to higher levels.

Mozilo co-founded Countrywide in 1969, and his employment contract runs through 2009, when he will be 71. Critics have faulted him for taking too much lending risk and for cashing in tens of millions of dollars of stock options in 2006 and 2007 through a prearranged trading plan.

On Tuesday, employees sued Countrywide and Mozilo, saying the company's failure to warn of its deteriorating financial health cost them millions of dollars of retirement savings.

David Sambol, Countrywide's chief operating officer, said in a statement on Thursday that the company was confident it will be a long-term beneficiary of current market conditions.

(Additional reporting by Tim McLaughlin and Christian Plumb)