Republican presidential hopeful Rudy Giuliani vowed Tuesday to stop the flow of illegal immigrants into the United States by closely tracking visitors to the country and beefing up border security.

"We can end illegal immigration. I promise you, we can end illegal immigration," the former New York mayor said at a community center — the first of the day's two stops in this early voting state.

Giuliani said he would require a uniform identification card for foreign workers and students and create a central database to track the legal status of visitors to the country. He told the crowd of more than 300 that 12 million immigrants have entered the country illegally.

"That's a lot of people to walk over your border without being identified," he said.

Giuliani wants a tamperproof ID card that includes fingerprinting for everyone entering the country and a central database to track when they leave.

The ID card and other immigration proposals have been part of Giuliani's campaign speeches for several months. He says he would allow a pathway to citizenship only for illegal immigrants who identify themselves as illegal, who learn English and who go to the back of the line to apply.

Rival Mitt Romney has criticized Giuliani on immigration, arguing that he supported illegal immigration when he was mayor — a charge Giuliani rejected.

Romney said last week that Giuliani "instructed city workers not to provide information to the federal government that would allow them to enforce the law. New York City was the poster child for sanctuary cities in the country."

New York has never officially declared itself a "sanctuary city." Last month, New York Mayor Michael Bloomberg told Congress that the city protects residents' confidentiality when they report a crime or seek medical care or education — a local policy that dates to 1988.

Giuliani defended and supported that executive order while mayor.

Bloomberg has said repeatedly that immigrants are important contributors to the city's economy and crucial to the city's survival. Asked Monday about the idea of New York City as a sanctuary for immigrants, Bloomberg 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. They just — 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."

Answering Romney last week, Giuliani said New York "had the least amount of illegality per capita of any major city in the country and I brought that change about."

In South Carolina Tuesday, Giuliani said he would continue construction of a border fence, deport any illegal alien who commits a felony and propose that all immigrants who want to become citizens learn English.

Giuliani and Romney opposed the bipartisan immigration legislation backed by President Bush. Rival Sen. John McCain of Arizona was the only Republican candidate to support the measure.