WHEN Congress last wrestled with immigration reform, in 2007, John Boehner, then the leader of the Republican minority in the House of Representatives, denounced the bill under consideration as “a piece of shit”. George W. Bush, the president of the day, supported it, but many Republicans opposed it, mainly because it granted an amnesty of sorts to some of America’s 12m or so illegal immigrants. Over the next five years immigration reform languished in Congress, a victim of Democratic distraction and Republican opposition. Yet earlier this month Mr Boehner, now speaker of the House, declared himself “confident that the president, myself and others can find the common ground to take care of this issue once and for all.”

Barack Obama also seems optimistic. He recently said he expected a bill on the subject, including a mechanism to normalise the status of illegal immigrants, along with tougher penalties for hiring them and even-tighter border security, to be taken up in Congress early in the new year. Lindsey Graham and Charles Schumer, respectively a Republican senator and a Democratic one, have resumed talks on a bill they abandoned two years ago. Several conservative pundits who had been implacably opposed to anything that smacked of lenience towards illegal immigrants are suddenly declaring themselves untroubled by the idea. This week two prominent Republican strategists set up an outfit called Republicans for Immigration Reform.

The impetus for all this activity was the drubbing Hispanic voters have just given to Republican candidates with a hard line on immigration. Hispanics made up 10% of the electorate this year, up from 9% in 2008. They are almost certain to account for an ever bigger slice of voters at each successive election for decades to come. Mitt Romney, who had suggested making life so miserable for illegal immigrants that they would “self-deport”, mustered only 27% of Hispanic votes. Meanwhile Mr Obama, who had lifted the threat of deportation and offered work permits to certain young immigrants brought to America as children, won 71%.

Mr Romney was hardly the only offender. Republican legislatures and governors around the country championed harsh local laws in an attempt to crack down on illegal immigration. Republicans in the Senate have repeatedly obstructed the DREAM Act, a formal version of Mr Obama’s reprieve for young illegals. During the primaries the Republican presidential candidates competed to sound toughest on illegal immigrants. “We’re in a death spiral with Hispanic voters because of rhetoric around immigration,” Mr Graham said this week. Janet Murguía, the head of the National Council of La Raza, a Hispanic pressure group, agrees: “If Republicans care about getting into the White House again, they’re going to have to engage with the Hispanic electorate.”

Not all Republicans are convinced. Steve King, an obstreperous congressman from Iowa, plans a lawsuit to try to get the president’s initiative on young illegals rescinded. Many Republicans doubt that they would win over many Hispanics even if they changed their stripes on immigration. Ronald Reagan, for example, signed an amnesty in 1986 but the Republican candidate at the next election, George Bush senior, still got just 30% of the Hispanic vote. Indeed, if reforms include granting citizenship for illegals, Republicans risk creating more Democrats, while alienating white working-class supporters who worry that outsiders are taking their jobs. Abandoning the party’s stance on immigration in the hope of winning over some Hispanics “is like jumping off a cliff to see if someone catches you”, says Dan Stein of the Federation for American Immigration Reform, which advocates reduced immigration and opposes an amnesty.

Angie Kelley of the Centre for American Progress, a left-leaning think-tank, acknowledges that it will be hard to find many Republican votes for any deal that involves an amnesty. Most Republican representatives, in particular, occupy safe seats, and thus serve at the pleasure of Republican primary voters, whose views on the subject are much more rigid than those of the electorate as a whole. But Ms Murguía argues that enough Republican votes can be picked off to form a majority coalition along with the bulk of Democrats. There are strong economic arguments to be made in favour of reform, she points out, and the business lobby is keen. Some other typically Republican constituencies are also coming round, including law-enforcement groups and some evangelical Christians. And even if immigration reform does not make it through the incoming Congress, Ms Murguía insists, the fact that it has returned to the agenda so quickly and with support from such unexpected quarters is a clear sign of things to come.