Some Sunni Arabs were not pleased by the visit. "If the Republicans win the election, then nothing will really change in Iraq, and we need a big change to kick the occupiers out of the country," said Abu Mohammed, a 30-year-old barbershop owner in Samarra, north of Baghdad. "I would like to show him the schools and hospitals and how the children and women suffer."
Another Samarra shop owner, 52-year-old Hamid Saleh, said he wanted the Republicans to lose the election. "All I want is someone who works to fix my country, and not destroy it," he said.
American officials in Iraq said Mr. McCain's precise schedule was not being released for security reasons. He was joined on the trip by two close political allies, Senator Joseph I. Lieberman, independent of Connecticut, and Senator Lindsey Graham, Republican of South Carolina.
The three senators are also visiting Israel, London and Paris. Mr. McCain has said the trip is not primarily political. He told reporters last Friday: "I do want to emphasize again that the three of us are going as members of the Armed Services Committee."
On Thursday, however, Mr. McCain will attend a $1,000-a-plate fund-raising lunch at a home in London. His campaign has said Congress will be reimbursed for the political parts of the trip, including the fund-raiser.
Mr. McCain's advisers have been cautious about the perception that he is exploiting his overseas trip for political gain. None of his top political advisers are traveling with him, and his campaign has been careful to route questions about it to his Senate office. But they say they believe that the trip is clearly beneficial to Mr. McCain, enabling him to showcase his national security credentials while his Democratic counterparts continue to battle for the nomination.
The new dynamic in Iraq, with significant declines in American military and Iraqi civilian casualties, has significantly altered the political landscape for Mr. McCain since last spring, when American troop deaths spiked and his candidacy faltered. A low point of that period for Mr. McCain came last April when he drew ridicule for trumpeting a peaceful stroll through a Baghdad marketplace, which was actually backed by heavily armed American troops.
Mr. McCain stands to reap the most politically from any rise in public support for the war effort, having staked his candidacy on his unflagging backing of President Bush's troop escalation. While cautious about being overly ebullient about Iraq, Mr. McCain is almost invariably upbeat when he describes what is happening in Iraq.
He said last month, "Anybody who believes the surge has not succeeded, militarily, politically and in most other ways, frankly, does not know the facts on the ground."
A survey done in late February by the Pew Research Center for the People and the Press found that 48 percent of Americans believed that the war was going "very well" or "fairly well," up from 30 percent in February 2007, although a majority continued to believe it was a mistake.
Meanwhile, Senators Barack Obama and Hillary Rodham Clinton continue to reject the troop escalation out of hand, arguing that the political reconciliation it was supposed to help usher in has not occurred and will happen only if prodded by the prospect of American withdrawal.
Mrs. Clinton was scheduled to give a major speech on Iraq on Monday, in which her advisers said she would furnish details about her plan to begin withdrawing American troops within 60 days of coming into office, arguing it is the only way to force Iraqi politicians to take responsibility.
She was also expected to attack Mr. Obama over a recent statement by a former foreign policy adviser, Samantha Power, in which she said the Iraq withdrawal plan Mr. Obama had outlined while campaigning was a "best-case scenario" that he would revisit once in office. Mr. Obama has defended his stance on withdrawing troops. Mrs. Clinton's advisers said she would also take on Mr. McCain for a recent comment in which he said American troops could be in the country for 100 years.
Mr. McCain has defended that comment, made at a town hall meeting earlier this year in New Hampshire, arguing that he did not mean they would still be fighting but simply maintaining a presence in the region.