Stocks ended flat on Friday but capped the best week for Wall Street bulls in almost three years after data showed the U.S. unemployment rate dropped to a 2-1/2 year low.

The market gave back a 1 percent gain earlier in the session as traders booked profits after the S&P 500 failed to break through technical resistance near its 200-day moving average.

The retreat also came on caution before key events in Europe next week, including a European Union summit aimed at solving the two-year old euro zone debt crisis.

While traders were heartened by the drop in the unemployment rate, they were aware of Europe's ability to disappoint investors, especially after a more than 7 percent gain in the S&P 500 this week.

We've been led down the aisle so many times we're afraid the groom's not going to show up again, said Nicholas Colas, chief market strategist at the ConvergEx Group in New York.

There's an increasing expectation that when leaders meet next week they will have the framework of a resolution that will allow greater fiscal unity and some beginnings of a resolution to the European debt crisis.

Recent U.S. economic data has heartened investors. U.S. companies stepped up hiring and the jobless rate dropped to 8.6 percent from 9 percent, further evidence the recovery was gaining momentum.

The unemployment rate drop was the single most surprising number in employment data this year, Colas said.

The lowest estimate on a Reuters poll of 67 economists was 8.9 percent.

The S&P 500 came within striking distance of its 200-day moving average, a breach of which could signal more gains, and briefly turned positive for the year.

Financial shares were the biggest gainers on the day with the S&P financial index up 1.4 percent. JPMorgan Chase gained 6.1 percent to $32.33.

The Dow Jones industrial average dipped 0.61 point, or 0.01 percent, to 12,019.42. The S&P 500 shed 0.30 point, or 0.02 percent, to 1,244.28. The Nasdaq Composite edged up 0.73 points, or 0.03 percent, to 2,626.93.

For the week, the Dow rose 7 percent, the S&P 500 added 7.4 percent and the Nasdaq rose 7.6 percent. It was their largest weekly percentage advance since mid-March 2009.

If you had a good week, there's a very strong temptation to take everything off of your portfolio and wait for the next drop down, Colas said of the rally fade-out into the close.

U.S.-listed shares of Research in Motion Ltd dropped 9.7 percent to $16.77 after the BlackBerry maker said it will write down the value of its poorly received PlayBook tablet computer.

About 7 billion shares traded on the New York Stock Exchange, NYSE Amex and Nasdaq, below the current daily average for the year of 7.96 billion.

Advancing stocks outnumbered declining ones by more than three to two on both the NYSE and Nasdaq.

(Reporting by Rodrigo Campos; Editing by Kenneth Barry)