In his 2002 book, "Worth the Fighting For," John McCain offered this confession -- an acknowledgment of a restless mind: "Although I seem to tolerate introspection better the older I am, there are still too many claims on my attention to permit more than the briefest excursions down the path of self-awareness. When I am no longer busy with politics, and with my own ambitions, I hope to have more time to examine what I have done and failed to do with my career, and why."

A telling observation, or so it seems, and refreshingly candid for a public figure. But the words are not John McCain's. They were written by his longtime aide Mark Salter, McCain's literary alter ego. "Worth the Fighting For," like McCain's other four books, is by "John McCain With Mark Salter," as they all say on their covers. This comment on McCain's disinclination to commit introspection was "my surmise," Salter said in a recent interview in his windowless office at McCain headquarters in Crystal City. He explained his technique:

"It's his voice, but I'm going inside his head to speak some psychological truth about him. I'm drawing a conclusion based on my observation of him. I always show him: 'This is what I've written. This is what I think about you. Is this fair?' " No one is closer to McCain than Salter, who has been with him since 1989. Their associates describe a "mind meld" that has created an extraordinarily close partnership. But even Salter sometimes has to guess what McCain might be thinking, particularly on sensitive subjects. "Things go on inside McCain's head that rarely or never come out," Salter explained.

Yet much of what goes on inside McCain's head is neither mysterious nor hidden. There is an elaborate record of the principles and beliefs that govern McCain's thinking about politics and policy in the five books he and Salter have written, scores of speeches they have collaborated on over nearly two decades, and countless interviews, including one last week for this article.

That record reveals a complicated man whose approach to the world cannot be summed up in an aphorism or two. He is a striver and a combatant, often at war with himself, who has conducted a lifelong struggle "to prove to myself that I was the man I had always wanted to be," as he has written. Multiple influences have shaped his thinking, from his famous grandfather and father, both four-star Navy admirals, to his travels and his extensive reading of history and literature.

On many points, the thinking is clear and consistent. For example, McCain believes in a muscular mission for America. As he has put it: "Our nation has a unique place in the world. We are the greatest force for good on earth. We chart history's course. Yes, we must be involved in the destiny of other nations." His favorite president is Theodore Roosevelt, reformer at home, activist wielder of a big stick abroad. He has read Edward Gibbon's six-volume "History of the Decline and Fall of the Roman Empire" -- twice. But his favorite book is Ernest Hemingway's "For Whom the Bell Tolls," whose protagonist, Robert Jordan, has been McCain's hero since he was 13.

In the novel, Jordan, an American volunteer on the anti-fascist side of the Spanish Civil War, finds love, then chooses death in service to a hopeless cause he believes in. In last week's interview, conducted in the leather-covered first-class seats of his campaign plane, McCain was asked if he, like Jordan, is a "romantic fatalist." McCain answered quickly and forcefully: "Yes, yes." Salter described his boss's fatalistic philosophy: "Life sucks, but it's worth doing something about anyway."

McCain is a figure from an old-fashioned America that is out of fashion in our most cosmopolitan precincts -- the America of "Gunsmoke" and Gary Cooper, not "The Daily Show" and George Clooney. For McCain, "Duty, Honor, Country" isn't patriotic pablum but a credo to live by. And he has worked out a way to apply the credo to politics. He summarized it in a commencement address at Johns Hopkins in 1999, when he gave the graduates this advice:

"Enter public life determined to tell the truth; to put problem-solving ahead of partisanship; to defend the public interest against the special interests; to risk your personal ambitions for the sake of the country and the ideals that make her great. Keep your promise to America, and you will keep your honor. You will know a happiness far more sublime than pleasure."

"That's what it's all about," McCain said in the interview.

But such high-mindedness can be difficult to sustain, and when he fails to do so, McCain's self-criticism can be devastating.

Within months of delivering that commencement address, McCain was running for president for the first time, and violating his own credo. After losing the 2000 Republican presidential nomination , McCain and Salter wrote "Worth the Fighting For" (the title is taken from a line of Robert Jordan's in the Hemingway novel ), which gave McCain an opportunity to confess his shortcomings:

"I didn't decide to run for president to start a national crusade for the political reforms I believed in or to run a campaign as if it were some grand act of patriotism. In truth, I wanted to be president because it had become my ambition to be president. . . . In truth, I'd had the ambition for a long time."

That ambition led McCain into a moral lapse that appalled him. It involved an ongoing dispute in South Carolina over the tradition of flying the Confederate battle flag atop the state capitol, in Columbia. In a television interview, McCain said the flag was "offensive," and he appeared sympathetic to its critics. His aides were alarmed, fearing the consequences in the upcoming South Carolina primary, and they wrote a damage-control statement that McCain read repeatedly before television cameras. "I understand both sides," McCain said. "Some view the flag as a symbol of slavery. Others view it as a symbol of heritage. Personally, I see the battle flag as a symbol of heritage."

But that, McCain wrote a year later, was "a lie." The flag symbolized both slavery and the South's secession from "the country I love," and "should be lowered forever from the staff atop South Carolina's capitol."

"I had promised to tell the truth no matter what," McCain wrote in the book. "When I broke it, I had not just been dishonest, I had been a coward, and I had severed my own interests from my country's. That was what made the lie unforgivable."

'McCain Is All Emotion'

McCain's harsh self-criticism suggests the emotionalism that colleagues and friends say is typical of him. This was described recently by Gary Hart, the former senator from Colorado and a presidential candidate himself in 1984 and 1988. Hart befriended McCain in the late 1970s, when McCain was the Navy's liaison to the U.S. Senate. "He's a guy's guy, fun to be with," Hart said. When McCain married Cindy Lou Hensley in 1980 (his second marriage), Hart was a groomsman.

"I think his mind is visceral," Hart said, "driven less by thought and more by feelings. This doesn't mean he's totally reactive or without logic or thought processes; it just means he's a fighter pilot. He reacts to circumstances."

A senior official in the Clinton administration who worked with McCain on Bosnia and Kosovo, where McCain defied most of his Republican colleagues to support strong U.S. action against Serbia, agreed. "In the many, many years that I've been in Washington," this former official said, insisting on anonymity to avoid upsetting McCain, "John McCain is far and away the most emotional politician I have ever met."

"McCain is all emotion," the former official continued. "People don't understand that, so they keep talking about his temperament, his temper. He reacts emotionally, therefore unpredictably."

McCain can be impatient with complicated answers to questions he considers straightforward, with gray when he sees black and white. For example, he sees no gray outcome possible in Iraq: "In war," he has said, "there is no such thing as compromise; you either win or you lose." But he has not defined victory in Iraq, and many wars have ended ambiguously.

McCain's commentary on Iraq often echoes his descriptions of the Vietnam War. He can make both sound like classical military confrontations and rarely mentions their political complexities. Asked about this in the interview, McCain said the North Vietnamese won with a tank-led invasion of South Vietnam at a time when President Richard Nixon, hobbled by the Watergate scandal, could not respond by using American air power. "We lost in Vietnam because we lost the will to fight, because we did not understand the nature of the war we were fighting, and because we limited the tools at our disposal," McCain has said, implying that the war could have been won -- again without defining victory.

Is it possible that in both Vietnam and Iraq, "victory" was and is beyond the reach of the United States, because in both cases only locals -- Vietnamese and Iraqis -- could ensure a satisfactory outcome to the conflict by finding a political resolution? McCain is impatient with this argument. In recent days, he has all but declared victory in Iraq: "This conflict has succeeded," he said in the interview. "All I can say is they [the Iraqis] are establishing the rule of law, they're going to be having elections, and I think they're becoming an effective government, which is what our strategy was, thanks to the genius of a guy named David Petraeus."

McCain has repeatedly lambasted Sen. Barack Obama (D-Ill.) for failing to understand the Iraq war. McCain was asked about Obama's warnings in 2002 that a war against Iraq was a bad idea that would require a U.S. "occupation of undetermined length, at undetermined cost, with undetermined consequences." Wasn't Obama more prescient than McCain, who gave repeated prewar assurances such as "the Iraqi people will greet us as liberators" and "we will win it easily"? McCain replied: "I think that's a legitimate question."

Then he added: "But the fact is, we did win easily. It was terribly mismanaged."

Constant Pursuit of Knowledge

McCain is a restless seeker of stimulation and information. Books are one source -- "He's a voracious reader, a constant inquirer," said Salter. McCain jokes about his lousy academic record (he finished fifth from the bottom of his class at Annapolis) but is clearly proud of what he has learned from reading and travel. And he uses Senate hearings as seminars.

"What he really enjoys, although the witnesses seldom do, is to put opposing witnesses on the same panel, and sit back and watch them fight, and see who has the best argument," Salter said. The Senate Commerce Committee chaired by McCain did this in 2001-02 during hearings on global warming, convincing the chairman that the scientific debate was settled -- the Earth is warming.

Learning from conflict is a method McCain happily defends. Asked to compare the smoothly running Obama campaign with his own, which has featured tumult and repeated changes of personnel, he said: "I'm happy with the way our campaign is run. . . . It should be chaotic, I should have Mark [Salter] and Steve and Rick and Charlie and these guys on the line arguing with each other and saying, 'Baloney!' . . ." He was referring to Steve Schmidt, who runs the campaign day-to-day; Rick Davis, who was recently displaced by Schmidt; and Charlie Black, the Washington lobbyist who is his senior counselor.

"If I win this campaign," McCain said, "historians will say, 'He was a genius' " who adapted under pressure.

McCain also seems to enjoy extracting information from individuals. In July, on the recommendation of Henry A. Kissinger, the McCain campaign invited Prof. Philip Bobbitt of Columbia Law School to discuss his new book, "Terror and Consent." This dense tome, nearly 700 pages, challenges many widely held beliefs about terrorism and how to counter it. Bobbitt, a Democrat who worked in the Carter and Clinton White Houses, said his book "demands time, discipline, imagination of a reader."

In extended conversations over two days, the senator and the professor impressed each other. McCain praised Bobbitt's intellect, and Bobbitt described the senator as a serious interlocutor who had obviously read most of his book. "McCain is quite lively and dexterous intellectually -- he seems willing to listen to criticism and reevaluate positions, and he doesn't mind being challenged," Bobbitt said.

Bobbitt's subjects were of obvious interest to McCain. Experts on the financial markets have had a different experience with the candidate. One who met with McCain earlier this summer to discuss the subprime lending crisis said McCain spoke about it only "in platitudes," relying on populist political talking points. McCain did not seem to understand economics, or to be interested in the subject, said this person, who insisted on anonymity to discuss the meeting.

McCain admitted his lack of expertise to the Wall Street Journal in 2005: "I'm going to be honest: I know a lot less about economics than I do about military and foreign policy issues. I still need to be educated."

High technology has not been one of McCain's subjects, either. His curiosity did not extend to the Internet until this year, a source of criticism during this campaign. His staff has recently helped McCain learn how to read news online and political blogs. McCain dismissed the matter in the interview: "I'm on the computer all the time now." He lived without it for many years and still does not send e-mails.

McCain wrote in "Worth the Fighting For": "We can all stand a little self-improvement from time to time, but it's hard to accomplish when you have reached my age."

Apparent Contradictions in Terms

McCain's principles are clear-cut, even if, by his own account, he cannot always uphold them. His specific policy positions can be less clear, and less consistent.

For example, in a speech this past spring, McCain called for expelling Russia from the Group of Eight, the club of leading economic powers, on the grounds that Russia is not a real democracy. Not long after, he gave a speech in Denver on arms control and suggested that the United States "can work in partnership with Russia to strengthen protections against weapons of mass destruction."

"Would that happen before or after we kick them out of the G-8?" quipped a Republican arms control expert who held high positions in previous Republican administrations.

Asked about this, McCain seemed to back off the threat to expel Russia from the G-8. "Well, you know," he said, "I'd like to send them a hard signal [but] . . . you need to work with them in areas of common interest." But Sunday on ABC's "This Week," McCain returned to the idea of expelling Russia from the G-8. "We need to improve their behavior," he said.

McCain has promised to appoint more Supreme Court judges like John G. Roberts Jr. and Samuel A. Alito Jr. Both of them signed recent opinions that narrowed the application of McCain's greatest legislative monument, the Bipartisan Campaign Reform Act of 2002. Lawyers who follow the issue say Roberts and Alito appear dubious about the constitutionality of some aspects of the law, which governs campaign contributions.

If a President McCain appointed more justices like Roberts and Alito, would that mean the death of the law?

"I don't know if it will or not, but I think you've got to have people who you think would interpret the Constitution of the United States most accurately," McCain replied. "Whether that means that certain decisions go for or against you, then I think we just have to -- obviously you can't have litmus tests."

Philosophically, McCain has never been easily pigeonholed, perhaps because philosophy doesn't interest him. But in Republican Party politics, philosophy is an important identifier. This year McCain has courted the conservative Republican base, casting himself as a "small-government, low-tax" Reagan Republican. But he acknowledges, when asked, he is really a Theodore Roosevelt Republican, and TR was hardly a conservative. He favored aggressive government regulation of the economy and a stiff inheritance tax -- both part of the Square Deal he pushed as his domestic agenda. TR also radically expanded the national park system and brought hundreds of millions of acres under federal protection or ownership. He was the country's first progressive president.

McCain has acknowledged that modern conservatives have been more hostile to government than he. "Many contemporary conservatives have let their healthy skepticism about government sink into something unhealthy, an embittered loathing of the federal government," McCain and Salter wrote in "Worth the Fighting For." A good government "must not shrink from its duty to be the highest expression of the national will and the last bulwark against all assaults on our founding ideals," which include liberty and opportunity.

In last week's interview, McCain recalled and embraced another TR quotation: "Unfettered capitalism leads to corruption. We are seeing that with the subprime lending crisis."

Reticence About the Campaign

Topic A for McCain this summer is the presidential election, but he hasn't shared much of his own analysis of the race. Obama has provided running commentary on the campaign, telling Dan Balz of The Washington Post last Friday, for example, that his trip to the Middle East and Europe "may not be decisive for the average voter right now, given our economic troubles, but it's knowledge they can store in the back of their minds for when they go into the polling place later." Noting the novelty of his candidacy, Obama has predicted that many Americans will remain uncommitted until much later in the campaign.

McCain has offered little analysis of the electorate's reaction to him or the path he hopes to follow to victory in November. Although he hammers Obama in public appearances, he also has respectful words for his opponent. In the interview last week, he said, "I'm surprised that I am as close in the polls as I am right now. When you look at the fantastic campaign that Senator Obama has waged, it really is quite remarkable."

Two books that McCain has not read are the bestsellers written by Obama. Isn't he curious about his opponent? "Well, I've been watching DVDs of his debates," McCain replied, "and I pay attention to his speeches."

Does this combination of respect for Obama's campaign and apparent indifference to his books suggest another example of McCain's romantic fatalism? Salter, the alter ego, emphatically rejected that idea. "I can tell you right now," he said of McCain, "he can't stand losing. . . . And sometimes when he's losing, it's not all romantic and glorious. He gets pretty tough. . . . He's as resilient a human being as I've ever encountered. There are no permanent defeats for him."