The astronomical valuation for Facebook is evidence that Microsoft executives believed they could not afford to lose out on the deal. Google appears to be building a dominant position in the race to serve advertisements online. Fearing it might lose control over the next generation of computer users, Microsoft has been trying to match and in some cases block Google’s plans, even if that effort is costly.

“We are now stepping outside what is typically a business decision,” said Rob Enderle, the founder of the strategy concern Enderle Group. “This was almost personal. I wouldn’t want to be the executive that’s on the losing side at either firm.”

A Google spokesman said the company had no comment. Facebook is planning to comment on the deal later today.

Representatives of Facebook say the investment will allow it to add employees, expand overseas and aggressively develop its own advertising system that will tailor ads to the personal preferences users make public on their Facebook pages. Facebook is expected to introduce such an ad network at an event in New York next month.

The Microsoft investment throws the value of the holdings of Facebook investors into the stratosphere. Mark Zuckerberg, the 23-year-old Facebook founder who dropped out of Harvard to build the company, owns a 20 percent share which is now valued at $3 billion. Accel Partners, the venture capital firm that invested $12.7 million in May 2005 and owns 11 percent of Facebook, now holds stock worth $1.65 billion.