Senator John McCain, who drew criticism last month after he warned against broad government intervention to solve the deepening mortgage crisis, pivoted Thursday and called for the federal government to aid some homeowners in danger of losing their homes, by helping them to refinance and get federally guaranteed 30-year mortgages.

“There is nothing more important than keeping alive the American dream to own your home, and priority No. 1 is to keep well-meaning, deserving homeowners who are facing foreclosure in their homes,” Mr. McCain said in a speech on economic themes that he gave at a window company in the Bay Ridge section of Brooklyn.

Mr. McCain, an Arizona Republican, had been painted as uncaring by Democrats, and drew murmurs of concern from some Republicans, after a speech in California last month in which he cautioned that “it is not the duty of government to bail out and reward those who act irresponsibly, whether they are big banks or small borrowers,” and noted that the crisis had been brought on by both lenders and borrowers.

Since then, he has gone out of his way to try to signal that he understands that times are tough and that people are hurting. His speech in Brooklyn  which is to be followed by what aides are billing as a major economic address next week  was a shift in tone, and part of a new effort to communicate that as president he would act to help Americans in financial distress.