In yet another twist in its five-month-old pursuit of Yahoo, Microsoft said Monday that it would be interested in negotiating a purchase of Yahoo’s search business or of the entire company, as long as Yahoo replaces its board.

Mr. Icahn is mounting a proxy fight against Yahoo’s board, one built on the gamble that he can bring Microsoft back to the negotiating table.

But without a commitment from Microsoft to complete a deal, let alone any discussion of price, it is unclear whether Microsoft’s announcement will be sufficient to persuade Yahoo shareholders to back Mr. Icahn at the company’s annual meeting on Aug. 1.

Microsoft’s renewed interest in possibly buying all of Yahoo represents another acknowledgment that it badly needs Yahoo to compete with Google in Web advertising. But analysts said that for Microsoft, which this year had considered waging a proxy fight for control of Yahoo, backing Mr. Icahn also represents a shrewd strategy with little downside risk.

“It is beautiful,” said Youssef Squali, an analyst with Jefferies & Company. “Icahn is doing the dirty work, and they don’t need to commit to anything until they feel that the board is ready to deal. They are letting the prey come to them instead of chasing it.”

The new informal alliance between Mr. Icahn and Microsoft came together after a series of conversations between Mr. Icahn and Steven A. Ballmer, the Microsoft chief executive, during the last week, Mr. Icahn said in a letter to Yahoo shareholders.

“Steve made it abundantly clear that, due to his experiences with Yahoo during the past several months, he cannot negotiate any transaction with the current board,” Mr. Icahn wrote.

He later added: “However, Steve made it clear to me that if a new board were elected, he would be interested in discussing a major transaction with Yahoo,” like the purchase of the search unit or the whole company.

In an apparently coordinated statement, Microsoft confirmed its interest in negotiating with a new board, but said it was not ready to disclose publicly the specific terms of any transaction. In an interview, Mr. Icahn said he understood Microsoft’s interest in replacing the board.

“If you’re going to put up $45 billion, you certainly can’t be blamed for wanting to have faith in the stewardship of the company, especially if you have to wait a year to buy it,” he said, referring to the time it would take to get regulatory approval for the deal. “I believe Ballmer wants to buy it one way or the other.”

For its part, Yahoo sought to cast doubt on Microsoft’s commitment to acquire the company and suggested it would be risky for shareholders to endorse Mr. Icahn’s slate of directors without such a commitment.

“If Microsoft and Mr. Ballmer really want to purchase Yahoo, we again invite them to make a proposal immediately,” Yahoo said in a statement. “And if Mr. Icahn has an actual plan for Yahoo beyond hoping that Microsoft might actually consummate a deal which they have repeatedly walked away from, we would be very interested in hearing it.”

Microsoft withdrew its offer to buy Yahoo outright on May 3 after Yahoo executives said they would be willing to sell the company for $37 a share. Microsoft had offered $33 a share, or about $47.5 billion.

Two weeks later, Microsoft said it was interested in buying Yahoo’s search business, but the company has said time and again that it was no longer interested in buying all of Yahoo, not even for $33 a share.

An error has occurred. Please try again later.

You are already subscribed to this email.

Yahoo has said that selling its search business alone would not be in the best interest of shareholders. On June 12, it said talks with Microsoft had ended, and it signed an alternative search advertising partnership with its No. 1 rival, Google. Yahoo could withdraw from the partnership if it pays a breakup fee.

It is too early to handicap the outcome of Mr. Icahn’s proxy fight, as most major Yahoo shareholders have yet to say whether they will support him. Several large shareholders have said recently that they favored a deal with Microsoft, and they have voiced their anger at Yahoo’s management for its inability to consummate a merger.

Yet many have been unwilling publicly to endorse Mr. Icahn, who, they fear, lacks a specific plan, other than hoping to sell the company to Microsoft.

Some analysts said Microsoft’s statement Monday did little to change that calculus. But some Yahoo shareholders said they thought Mr. Icahn would be more effective in leading Yahoo than the current management, whether or not he succeeds in selling the company or its search business to Microsoft.

“If Microsoft comes back with a deal that is completely unattractive, we’d be back to where we are today,” said Mark Nelson, a partner at Mithras Capital, a private fund that owns about 1.7 million shares of Yahoo. “But the difference is that Icahn would be more aggressive in dealing with where Yahoo goes next.”

About 10 percent of the company’s shares were owned by Yahoo directors and executive officers as of May 7, according to a regulatory filing. Most of those were held by its co-founders, David Filo, with a 5.79 percent stake, and Jerry Yang, the chief executive, with a 3.9 percent stake.

Mr. Icahn owned about 59 million shares, or more than 4 percent, according to a June 6 filing. Mr. Icahn paid about $25 a share, on average. After Microsoft’s announcement Monday, shares of Yahoo rose $2.56, or nearly 12 percent, to $23.91.

Yahoo’s largest shareholder is Capital Research and Management Company, the giant investment firm, which owns about 16 percent of the shares. Its ownership of Yahoo is divided between two units, Capital World Investors, with a 9.8 percent stake, and Capital Research Global Investors, with 6.2 percent.

Gordon Crawford, a portfolio manager with Capital Research Global, has been openly critical of Yahoo’s management but his company has not publicly endorsed Mr. Icahn. Managers at Capital World have not spoken publicly about the proxy fight, but privately they have been far more supportive of Yahoo’s management and board, according to two people familiar with their views who spoke on condition of anonymity because they were not authorized to discuss them.

A spokesman for Capital Research and Management declined to comment Monday.

Keith Gottfried, a partner in the shareholder activism practice of the law firm Blank Rome, said the downturn in the stock market could influence many fund managers to vote their shares for Mr. Icahn in the hope that he could complete a deal with Microsoft.

“I wouldn’t underestimate the effect that the bear market has,” Mr. Gottfried said. “Any opportunity that fund managers have to lessen the losses that they are likely to show in other parts of their portfolio might make them more willing to support a transaction.”

Andrew Ross Sorkin contributed reporting from New York.

A version of this article appears in print on , on Page C1 of the New York edition with the headline: Microsoft Is Icahn’s Ally in Pursuit of Yahoo. Order Reprints|Today's Paper|Subscribe