Stocks fell on Friday after a court ruling in a key foreclosure case prompted investors to pull out of bank stocks, adding to weakness after a lackluster jobs report.

Even with the decline, however, the S&P 500 and Dow recorded their sixth straight week of advances. The market has proved resilient despite expectations that stocks were due for a pullback.

Wells Fargo & Co and US Bancorp lost a ruling by Massachusetts' top court, which said the banks failed to show they held the mortgages at the time they foreclosed.

The court decision is the latest on the validity of foreclosures conducted without full documentation, and the ongoing mortgage fiasco could prove costly for the banks. The news turned the market lower but some said the reaction was overdone.

Financials have really been a leader in the market in recent weeks -- this could close that sector out, said Nick Kalivas, senior equity index analyst at MF Global in Chicago.

Wells Fargo shares gave up 2 percent at $31.50 and US Bancorp eased 0.8 percent to $25.09. The KBW Bank index <.BKX> lost 0.9 percent.

The S&P financial index <.GSPF> rallied more than 10 percent in December as investors searched for bargains at the end of the year.

On Friday the Dow Jones industrial average <.DJI> slipped 22.55 points, or 0.19 percent, to 11,674.76. The Standard & Poor's 500 Index <.SPX> was off 2.35 points, or 0.18 percent, to 1,271.50. The Nasdaq Composite Index <.IXIC> declined 6.72 points, or 0.25 percent, to 2,703.17.

For the week, the S&P 500 rose 1.1 percent, the Dow gained 0.8 percent and the Nasdaq climbed 1.9 percent.

Investors treaded lightly after the employment report, which showed non-farm payrolls rose a less-than-expected 103,000. But overall employment for October and November was revised upward to show 70,000 more job gains than previously reported.

The Labor Department report showed a surprisingly large number of people gave up searching for work, tempering the positive news of a big drop in the unemployment rate.

Analysts said that while the data showed steady, if slow, progress, it did not meet expectations that had risen through the week.

The mortgage issue has been overhanging banks, prompting an uproar last year that led lenders such as Bank of America Corp , JPMorgan Chase & Co and Ally Financial Inc to temporarily stop seizing homes.

On the upside, the energy sector capped declines as Diamond Offshore rose 4.9 percent to $70.57 after Goldman Sachs upgraded the driller. Goldman also upgraded Baker Hughes Inc , sending its shares up 3.2 percent at $56.60.

The S&P 500 found support at its 14-day moving average, which is around 1,262. The index briefly broke below that before popping back up.

On Capitol Hill, Federal Reserve Chairman Ben Bernanke sounded cautiously more upbeat than in the recent past, citing improvements in consumer spending and a drop in claims for jobless benefits as hopeful signs for the recovery.

(Reporting by Leah Schnurr, additional reporting by Ryan Vlastelica; Editing by Kenneth Barry)