Mr. McCain cast the process, at least in those days, as orderly and said that the last thing he wanted was the kind of rushed decision that President George Bush had made in 1988 in selecting his running mate, Dan Quayle, then a senator from Indiana.

But it was not until the last few weeks that Mr. McCain winnowed his list to five or six finalists. They included, a McCain adviser said, Mr. Pawlenty, Mr. Romney, Mr. Lieberman, Ms. Palin and Tom Ridge, the former governor of Pennsylvania who also supports abortion rights. Ms. Palin, unlike the others, was barely mentioned in news media speculation.

The finalists, including Ms. Palin, were vetted, a campaign adviser said, and Mr. McCain then asked his inner circle  Mr. Salter, Rick Davis, Steve Schmidt and Charlie Black  to provide him with assessments of each. “He said, ‘Give me plusses and minuses on each of these people,’ ” Mr. Black said.

One of Mr. McCain’s closest friends, Senator Lindsey Graham, Republican of South Carolina, weighed in as well, pushing so hard for Mr. Lieberman  Mr. McCain, Mr. Graham and Mr. Lieberman are longtime traveling companions  that he vexed some of the other advisers. Others in the inner circle favored Mr. Pawlenty or Mr. Romney. Ms. Palin had no strong advocates in the group, an outside adviser said, but she had no detractors, either.

Last Sunday, 24 hours after Mr. Obama announced his running mate, Senator Joseph R. Biden Jr. of Delaware, Mr. McCain met with his senior campaign team at the Ritz-Carlton Hotel in Phoenix. By then, campaign advisers said, the group had long decided that Mr. McCain’s “experience versus change” argument against Mr. Obama had run its course, to the extent that it had worked at all.

At the same time, Mr. Obama’s coming acceptance speech before a stadium of about 80,000 people (and what turned out to be a television audience of nearly 40 million) loomed large. As much as the campaign was publicly dismissing Mr. Obama as a celebrity in a rock-star setting, the concern was that his command of such a large crowd on the last night of the Democratic convention would give him the aura of a president.

In any case, one campaign adviser said, Mr. McCain hated running as the wizened old hand of experience. Despite his embrace this year of President Bush and many of the administration’s policies, Mr. McCain, a campaign adviser said, still saw himself as the maverick who delighted in occasionally throwing political grenades at his own Party.