PHOENIX — The Arizona Senate passed one of the most stringent immigration laws in the country on Monday, marking a new level of influence for a Republican state senator who not long ago was seen by many as an eccentric firebrand.

Passage of the law, which would, among other things, allow the authorities to demand proof of legal entry into the United States from anyone suspected of being in the country illegally, testified to the relative lack of political power of Arizona Latinos, and to the hardened views toward illegal immigration among Republican politicians both here and nationally.

As if to underscore how the political landscape will be changed by the law, Senator John McCain, Republican of Arizona, who had refused to back the most extreme anti-immigration measures, came out in support of it just hours before its passage.

“I think it is a good tool,” said Mr. McCain, who is being challenged in a primary by a conservative former congressman who is thumping him on immigration. Mr. McCain added that he believed the bill reflected frustration that the federal government had not done enough to secure the border and enforce immigration law.