In contrast, Mr. McCain’s relationship with evangelicals has long been troubled. In 2000, when he was running against Mr. Bush for the Republican nomination, Mr. McCain castigated Pat Robertson and the Rev. Jerry Falwell as “agents of intolerance.”

In a sign of the lingering distrust, Mr. McCain finished last out of nine Republican candidates in a straw poll last year at the Values Voter Summit in Washington, a gathering for socially conservative activists.

James C. Dobson, the influential founder of the evangelical group Focus on the Family, released a statement in February, when Mr. McCain was on the verge of securing the Republican nomination, affirming that he would not vote for Mr. McCain and would instead stay home if he became the nominee. Dr. Dobson later softened his stance and said he would vote but has remained critical of Mr. McCain.

“For John McCain to be competitive, he has to connect with the base to the point that they’re intense enough that they’re contagious,” said Tony Perkins, president of the Family Research Council. “Right now they’re not even coughing.”

The balancing act Mr. McCain faces in appealing to both moderate voters and evangelicals was starkly illustrated last month when he rejected the endorsements of the Rev. John Hagee and the Rev. Rod Parsley, prominent evangelical leaders, after controversial statements by the two came to light. Mr. Parsley has been vocally anti-Islam and Mr. Hagee, in a sermon, said Hitler and the Holocaust had been part of God’s plan to drive the Jews to Palestine.

Mr. McCain’s actions complicated his relationship with evangelical leaders, some of whom said in interviews that the senator’s actions contributed to the impression among some evangelicals that he did not know or understand them. They argued that he should have stood by them, while making clear that he did not necessarily agree with all of their views.

“I think that was a stumble that will add to the challenges here,” said Gary Bauer, president of the group American Values, who in February became arguably the most visible evangelical leader to begin actively working on Mr. McCain’s behalf. “Those are both very influential men and it will just make things more challenging to accomplish between now and November.”