Almost eight years ago, Yahoo decided to lend a little start-up a helping hand, featuring its search technology on the Yahoo home page and giving it money at a critical juncture.

In cutthroat Silicon Valley, no good deed goes unpunished.

The start-up was Google, and Yahoo’s generosity helped launch the most formidable competitor it had ever encountered. Now facing a takeover attempt by Microsoft, Yahoo is coming to terms with the punishing consequences of its complex relationship with Google, including a futile attempt to copy Google’s extraordinarily profitable advertising model at significant cost to Yahoo’s own business.

Long before the world learned that Google had turned the Internet into an amazing money-minting machine, Yahoo knew.

When Google was still a private company, it sent its financial statements to Yahoo’s headquarters in Sunnyvale like clockwork. Google had to because Yahoo was one of its earliest investors.

The statements showed the incredible growth of Google’s search advertising business, with sales more than doubling from quarter to quarter.

But Yahoo executives didn’t focus on the money; they were interested in how much traffic was being driven by search, recalled Ellen Siminoff, an executive who joined Yahoo in 1996.

In 2000, Yahoo agreed to use and promote Google, which it touted as “the best search engine on the Internet.” Google co-founder Larry Page described the pact as a “major milestone.”

The following year, Yahoo was even more generous, paying Google $7.2 million for its services. (Google in turn paid Yahoo $1.1 million for promotional help.) Google desperately needed the money, which helped pushed it into the black for the entire year.

Yet Yahoo was hardly flush with cash. After two years of profit, Yahoo reported an annual loss of $93 million in 2001. The value of its stock had collapsed from $118.75 a share in January 2000 to $4.05 in September 2001.

Meanwhile, Yahoo’s promotional push was having an effect on Google. “When we were turning the business around in 2001, Google was already becoming the ascendant player in Europe, especially in the U.K., which is one of the most important advertising markets,” recalled L. Jasmine Kim, a former vice president for global marketing and sales development for Yahoo.

Members of the international team tried to telegraph their concern to Sunnyvale, Kim recalled. “In hindsight, it is easy to say we should have seen it as we did discuss our concerns, but technology moves at the speed of light. The game changed.”

Yahoo management did not respond to questions about the company’s relationship with Google.

The paranoid survive

The tech industry’s giants – like Microsoft, Intel and Oracle – are famous for ruthlessly dealing with competitors. Not Yahoo.

In 2002, Yahoo paid Google $13.2 million, equivalent to more than a quarter of Yahoo’s annual profit of $43 million. The sum, however, meant less to Google, which had blown past its benefactor with an annual profit of about $100 million.

But the price of coddling Google would be much higher, as Yahoo soon discovered.

In May 2001, Yahoo replaced Chief Executive Tim Koogle, a folksy, guitar-playing engineer, with Terry Semel, a veteran Hollywood deal maker who had rarely used e-mail.

Semel may not have been a technology guru, but he knew search would be key to Yahoo’s success.

He also realized Yahoo had a big problem: It had neither its own search technology nor the software for handling search advertising.

Semel’s first move: He struck a deal with Pasadena-based Overture Systems to provide ads for Yahoo’s search results. Then he tried to buy Google.

After those talks fizzled in 2002, Semel acquired Inktomi, a search engine, for $235 million in December 2002. Seven months later, he bought Overture for $1.6 billion.

The deals gave Yahoo a huge boost. In 2004, revenue doubled and profit more than tripled. Yahoo’s stock vaulted from $16.10 a share on the day the Overture deal was announced July 14, 2003, to $37.68 at the end of 2004.

In early 2005, when both companies reported their 2004 earnings, it seemed like Yahoo and Google might even be neck and neck. While Google had revved its profit engine harder – for an increase of 276 percent compared with Yahoo’s 252 percent – Yahoo boasted a larger increase in sales – 119 percent to Google’s 113 percent.

“What’s even more important than exceeding any one of our financial targets, however, is the way in which we’ve achieved them, and they do flow from a robust foundation,” Chief Financial Officer Sue Decker told analysts in January 2005.

Semel and Decker told Wall Street that Yahoo was in a better position than Google because it sold both search advertising, ads triggered by search queries, and display advertising, image-based ads that appear as banners or other graphical elements on a Web page.

The executives explained that Yahoo could cross-sell the two kinds of advertising and be a one-stop shop for the world’s biggest brands.

“It became clear over the course of a year that there wasn’t anything to that,” said Mark Mahaney, an analyst with Citigroup.

Swollen profits

It turned out Yahoo’s happy ending was more Hollywood than reality.

While Yahoo’s business had certainly improved, it was nowhere near catching Google.

Yahoo’s revenue in 2004 had doubled largely as a result of the acquisition of Overture. And its profit that year was swollen by the sale of $400 million of Google stock.

Yahoo sold its remaining stake in Google, roughly 4.2 million shares, the following year for nearly $1 billion, again boosting its profit.

Executives continued to tout Yahoo’s financial performance. “I am very proud of the remarkable growth and progress Yahoo has demonstrated throughout this past year,” Semel said on Jan. 17, 2006.

But shares fell 13 percent the next day as investors responded to the news that core profit was a penny less than analysts had expected.

And the rate of sales growth fell by more than 60 percent, exposing the isolated bump Yahoo’s sales had received from buying Overture.

Yahoo’s stock plunge

During the next two years, Yahoo’s stock plunged an additional 45 percent. On Jan. 31, the day before Microsoft made its bid, Yahoo traded at about $19 a share, the same level it traded at in fall 2003.

In 2007, Yahoo introduced new software that boosted the amount of money it earned from search advertising. Investors had waited years for the project known as “Panama” to be completed. The technology was seen as key to Yahoo regaining competitiveness.

But Panama didn’t come close to closing the gap with Google. Yahoo’s sales that year were almost $7 billion, compared with $16.6 billion for Google.

Worse, Yahoo said it expected to grow only about 10 percent the following year. (Google doesn’t forecast future growth; however, its revenue increased 57 percent in 2007.)

“We are disappointed with guidance and don’t expect investors to have confidence in management’s investment decisions,” Rob Sanderson of American Technology Research wrote in a note Jan. 30.

Unable to compete with Google in search advertising, Yahoo also appeared to be losing its edge as the leader in display advertising.

In September 2006, Decker and Semel warned they were seeing weakness in display advertising related to financial services and cars. “We think it is kind of early to tell whether this is a sign of anything broader,” Decker cautioned.

In fact, it was the beginning of a long slide. Analyst Doug Anmuth of Lehman Brothers estimates that the growth of Yahoo’s display business dropped by half, from 33 percent in 2006 to 16.5 percent in 2007.

The main cause of the decline was increased competition, especially from social-networking sites like MySpace and Facebook.

However, plenty of former Yahoos also blamed top management in Sunnyvale. “They were concentrated on two things: technology and technology,” said Jerry Shereshewsky, a senior Yahoo marketing executive who left the company in summer 2007 and is now CEO of Grandparents.com.

“Yahoo as a company never really understood they were first and foremost in the media business supported almost wholly by advertising.”

Former employees from other divisions also faulted management as indecisive, said more than a dozen who asked not to be quoted by name because it might hurt future business opportunities.

Other complaints: Upper management was plagued by cronyism. Even when new ideas got a green light, the projects were starved of resources. There were too many people with inflated titles, too many business units and too little cooperation among them.

Among the missed opportunities, former employees said, was a chance to buy Facebook when Mark Zuckerberg was still enrolled at Harvard University and open to a deal.

Around the same time, business development people at Yahoo unsuccessfully tried to stir up interest in MySpace. But senior executives wanted major deals that would “move the needle,” said a former employee. MySpace was too small.

In 2006, an effort to buy YouTube foundered when Yahoo insisted on a clause in the contract that gave Yahoo an out if the video-sharing site was sued. Google agreed to remove the clause and got YouTube.

By 2007, the social-networking sites would be big enough to challenge Yahoo for display advertising. According to industry estimates, MySpace ranked second only to Yahoo in revenue from display advertising and page views.

And YouTube was the Web’s undisputed top video destination, despite Yahoo’s efforts to compete.

Google’s newest move

Last week, Google announced its acquisition of DoubleClick, which inserts primarily display advertising on Web pages owned by major publishers.

“At best, it’s alarming for Yahoo,” said Jim Barnett, CEO of Turn, which provides software for optimizing display advertising. “Google already has the dominant position in search, and this puts Google in a very advantageous market position to take share in display.”

Here, too, Yahoo missed an opportunity. After the dot-com crash in 2000, Yahoo briefly considered developing similar software, but decided against it.

Since November 2006, Yahoo has been working to build software that will serve targeted display advertisements to members of a consortium that now includes more than 600 newspapers, including the Mercury News.

The software has been expected to provide a major boost to Yahoo and its newspaper partners. But it is still not ready. By the time it is finished, Yahoo could well be a division of Microsoft.