Stocks fell Friday as disappointing earnings from McDonald's offset better-than-expected results from Microsoft and a mega-merger announcement from Procter & Gamble and Gillette. Security concerns surrounding the Iraq elections Sunday also loomed over the market.

The Dow Jones industrial average (search) ended down 40.20 points, or 0.38 percent, to finish at 10,427.20. The Standard & Poor's 500 Index (search) was down 3.19 points, or 0.27 percent, to close at 1,171.36. The Nasdaq Composite Index (search) was down 11.32 points, or 0.55 percent, to end at 2,035.83.

However, all three indexes ended higher for the week — snapping a losing streak that had seen all three fall for the first three weeks of the year.

For the week, the Dow ended up 0.32 percent, the S&P 500 finished up 0.29 percent, and the Nasdaq closed up 0.08 percent — marking their first weekly gain of 2005.

"The market is preoccupied and worried about the Iraq election, as well as the weakness in the GDP result," said Peter Cardillo, chief market analyst and chief strategist at SW Bach and Co. "Another negative was Merck, which is why the Dow is under pressure."

The market failed to get a lift from consumer products company Procter & Gamble Co. (PG) announcing a $57 billion stock deal to buy Gillette Co. (G). The merger will bring together two iconic U.S. producers of household goods, ranging from P&G's Pampers diapers to Gillette's razors. P&G hurt the Dow, sliding 2.1 percent, or $1.17, to $54.15. Gillette's stock rose nearly 13 percent, or $5.91, to $51.60.

P&G's shares fell because the all-stock deal means that the number of its outstanding shares will dramatically increase — potentially reducing the earnings power of each share. Shares also fell due to merger arbitrage, in which investors short shares of the buyer, whose stock typically falls after a deal is announced, and go long on shares of the seller.

Large-scale deals typically lift the market as they are viewed as a sign of confidence in the economy, and raise hopes of a pickup in other acquisition activity.

"Usually something like this merger would be a catalyst for an 'up' day — and if it wasn't a Friday before the elections, I think we would have had that," said Robert Drust, managing director of listed trading at regional investment bank Wedbush Morgan.

McDonald's Corp. (MCD) saw its fourth-quarter profits triple from a year ago, though the fast-food chain fell short of Wall Street profit estimates by a penny per share. Revenues rose 10 percent from the year-ago quarter. McDonald's fell 12 cents to $32.

Dow component Merck (MRK) tumbled more than 10 percent as it said a federal judge ruled that its second-biggest product, the osteoporosis drug Fosamax, will lose its U.S. patent protection 10 years earlier than expected. Merck fell $3.16 to $28.02. In addition to the news on Fosamax, U.S. regulators elevated their probe of its withdrawn Vioxx arthritis drug into a formal investigation.

Surprisingly weak economic data pressured stocks. The Labor Department (search) reported that the nation's gross domestic product — the value of all goods and services produced in the United States — rose at an annual rate of just 3.1 percent in the fourth quarter, the lowest gain in seven quarters. Economists had expected a 3.5 percent rise.

Wall Street had expected the economy to slow somewhat from the 4 percent annual pace posted in the third quarter of 2004, but the latest reading showed far more of a slowdown than analysts had believed. That raises concerns about profit growth for future quarters as well as the health of the labor market.

"I definitely think the GDP backdrop is troubling. I think oil prices had a much bigger impact on the economy than people thought, and oil prices actually went down in the quarter," said Jack Ablin, chief investment officer at Harris Private Bank in Chicago. "I thought a 3.5 percent increase was in the bag. Now we'll see what the Federal Reserve thinks next week."

Microsoft (MSFT) edged 7 cents higher to $26.18 after its earnings, announced late Thursday, surpassed Wall Street's profit forecasts by 2 cents per share. The software giant and Dow component also reported its first profitable quarter for its home and entertainment division, thanks to strong sales of its Xbox Live online game service and the video game hit Halo2.

ChevronTexaco Corp. (CVX) lost 34 cents to $53.72 after it beat Wall Street profit expectations by 23 cents per share. High oil prices and strong demand helped double the company's profits from last year's quarter.

The Boeing Co. (BA) scored a major coup over rival aircraft manufacturer Airbus SAS with a $7.3 billion deal to provide six Chinese airlines with 60 of the company's new 7E7 Dreamliner passenger jets. It was the biggest order yet for Boeing's newest jet. Boeing nonetheless fell $1.05 to $49.92.

Overall, trading was active, with 1.64 billion shares changing hands on the New York Stock Exchange, above the 1.46 billion daily average for last year. About 2.09 billion shares were traded on Nasdaq, above the 1.81 billion daily average last year. Advancers outnumbered decliners on the New York Stock Exchange by 6 to 5 and by 3 to 2 on Nasdaq.

The Russell 2000 index of smaller companies was down 3.90, or 0.6 percent, at 613.00.

Overseas, Japan's Nikkei stock average fell 0.18 percent. In Europe, Britain's FTSE 100 closed down 0.42 percent, France's CAC-40 dropped 0.54 percent for the session, and Germany's DAX index lost 0.35 percent.

Reuters and the Associated Press contributed to this report.