It's the first real clash between two leading Republican candidates who are vulnerable on immigration, a volatile issue that infuriates Republican conservatives who hold sway over primary elections.
At issue are so-called sanctuary cities, places where city employees are not required to report illegal immigrants to federal authorities. Some, such as San Francisco, have declared themselves sanctuaries or refuges. Others, like New York, have never adopted the "sanctuary" moniker.
New York's policy, issued by Democratic Mayor Ed Koch in 1988, is intended to make illegal immigrants feel that they can report crimes, send their children to school or seek medical treatment without fear of being reported.
An estimated half-million illegal and undocumented immigrants live in New York, and only a fraction are deported each year.
"What's the best thing to do about that?" Giuliani asked in 1996. "Put them in a situation in which they keep children out of school? Put them in a situation in which they don't go to hospitals? Or put them in a situation in which they don't report crimes to the police?"
Giuliani went to court to preserve the policy, suing over a 1996 attempt by Congress to undo the city's protections. He lost, but Mayor Mike Bloomberg later issued a new, broader version of the policy that is still in effect.
In the presidential campaign, Giuliani and Romney are talking tough on immigration, even opposing the bipartisan immigration overhaul backed by President Bush. Yet their records are not necessarily tough. For example:
— Several illegal immigrants worked on Romney's lawn as employees of a lawn care company; Romney said he didn't know the company had hired illegal workers.
— As mayor, Giuliani often spoke positively about illegal immigrants: "If you come here, and you work hard, and you happen to be in an undocumented status, you're one of the people who we want in this city," he told The New York Times in 1994.
— Both Romney and Giuliani spoke favorably of 2006 legislation providing a path to citizenship for illegal immigrants; they opposed a similar bill earlier this year.
Immigration inflames conservatives in early voting states such as Iowa and South Carolina, where some argue that illegal immigrants are straining schools and hospitals, lowering wages or taking jobs from law-abiding citizens.
In Aiken, S.C., on Tuesday, Giuliani repeated a pledge to closely track immigrants with tamperproof identity cards, bolster fencing and law enforcement at the border and deport illegal immigrants who commit crimes.
Romney, inspecting border fencing and checkpoints Monday in San Diego, reiterated his plan to hire more Border Patrol agents, sanction employers who hire illegal immigrants and cut federal dollars for sanctuary cities.
Romney blames "don't tell" policies, and Giuliani's support for them, for luring millions of illegal immigrants to the United States.
"New York City was the poster child for sanctuary cities in the country," Romney said last week in Bettendorf, Iowa.
Giuliani's defense is that he cracked down on all crimes, including illegal immigration. "New York City had the least amount of illegality per capita of any major city in the country, and I brought that change about," he said last week in Colorado Springs, Colo.
And his campaign accused Romney of hypocrisy, pointing out that as governor of Massachusetts, Romney did not try to punish sanctuary cities — Cambridge, Orleans and Somerville — in his own state.
"He had three sanctuary cities in his own state," longtime Giuliani aide Randy Mastro said. "The New York City program was very different. We had a system that protected public safety by encouraging aliens to come forward to the authorities to report crimes, and then required authorities to cooperate in the investigation and prosecution of aliens who committed crimes."
Romney says he tried to curtail the problem by deputizing state police to enforce federal immigration laws.
"It was exactly in response to the fact that immigration laws were not being enforced," spokesman Kevin Madden said. "It was also in conjunction with his belief that enforcement has to be a joint state and federal effort."
Bloomberg, who may run for president himself, waded into the dispute this week. Asked Monday about the idea of New York as a sanctuary for illegal immigrants, he said, "Let 'em come."
"I can't think of any laboratory that shows better why you need a stream of immigrants than New York City," he added. "I don't know what to tell anybody. If they don't believe that immigrants add a heck of a lot more than they cost, they just aren't looking at the numbers."