President Obama struck many of the right notes on immigration reform in his speech Tuesday, delivered along the U.S.-Mexican border in El Paso, Texas.

On the substance of the policy, the president deserves two cheers from those of us who are convinced that enforcement alone cannot solve the problem of illegal immigration. But in politics as in show business, timing is just as important as substance, and the timing of the president’s newfound urgency is suspicious.

Framed by sun-drenched flags, President Obama told the cheering crowd that a secure border ultimately depends upon “fixing our broken immigration system.” He rightly called for legalizing the millions of undocumented but otherwise hardworking and law-abiding immigrants already here. The president did not call for “amnesty” but for the newly legalized workers to pay fines and taxes, learn English, submit to background checks and wait their turn to apply for permanent status.

The president also identified the need to expand opportunities for legal immigration in the future. As our research at Cato has shown, expanding temporary work visas would reduce the incentives for illegal immigration while allowing our agents on the border to redirect their resources to intercept terrorists and other real criminals.

A robust temporary worker program will be the key to successful immigration reform. It would allow American companies to hire the low-skilled immigrant workers they need for jobs that fewer and fewer Americans want to fill. This would allow important sectors of the economy to grow, such as retail, hospitality, landscaping and agriculture, creating employment opportunities up the skill ladder for middle-class Americans. It would increase investment, incomes and tax revenue across the economy.

Without a program for new workers, immigration reform will be doomed to fail.

The 1986 Immigration Reform and Control Act legalized 2.7 million undocumented immigrants and ramped up enforcement, but it failed to stem the inflow of illegal immigration because it did nothing to expand visas for future workers. Today everybody agrees the act was a failure.

President Obama also made a strong case for the DREAM Act, which would allow conditional permanent residency to undocumented students who did nothing wrong but dutifully follow their parents across the border when they were minors. The legislation would legalize those students who have been in the country for five years or more, have already embraced English and American culture, go to college or serve in the military.

But while President Obama said most of the right things in El Paso on Tuesday, his timing raised doubts about his commitment to actually get something done.

President Obama has talked a good game on immigration before. As a candidate in July 2008, he told the League of United Latin American Citizens that he would make immigration reform “a top priority in my first year as president.” On the Spanish-language network Univision, candidate Obama did himself one better, telling the Spanish-language audience, “What I can guarantee is that we will have in the first year an immigration bill that I strongly support and that I’m promoting.”

But when he became president in January 2009, immigration reform disappeared from the agenda, despite large Democratic majorities in the House and Senate. In his first two years in office, the president and his party rammed through health care, a nearly trillion-dollar stimulus and bailouts of GM and Chrysler, but they could not find the time to bring immigration reform up for a vote. So much for it being “a top priority.”

Now that Republicans have regained the House and boosted their numbers in the Senate, President Obama has rediscovered his former urgency for immigration reform. His stop in El Paso was only the latest in a series of speeches he has given on the subject. In the past few weeks he has held White House meetings on immigration with Hispanic celebrities such as actress Eva Longoria, but not with GOP House Speaker John Boehner.

The new chairman of the House Judiciary Committee, Texas Republican Lamar Smith, has made it clear his party will block (mistakenly, in my view) any efforts to expand legal immigration — so the prospects of actually moving immigration reform through the current Congress are somewhere between slim to none. But with the next election only 18 months away, talk of immigration reform plays well with the nation’s growing Hispanic electorate.

It’s enough to tempt a Washington cynic to believe the president and his party would rather trumpet immigration reform as an issue during a campaign than actually accomplish real reform while in office.