His past positions are directly at odds with President-elect Donald Trump's stated immigration policy, which is to end so-called sanctuary cities and deport millions of undocumented immigrants.

Giuliani is under serious consideration to join Trump's incoming administration in a high-level cabinet position, reportedly secretary of state or attorney general. A source familiar with the transition process told CNN this week Giuliani preferred secretary of state. Either role would give Giuliani a hand in federal immigration policy.

A spokesperson for Giuliani did not return a request for comment.

As New York City mayor, Giuliani praised the contribution undocumented immigrants made to the city and even went to court to protect them from being reported to the federal government.

"Some of the hardest-working and most productive people in this city are undocumented aliens," Giuliani said at a 1994 press conference . "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. You're somebody that we want to protect, and we want you to get out from under what is often a life of being like a fugitive, which is really unfair."

Appearing on WABC in 2001, Giuliani said, "The city of New York, quite frankly, is quite tolerant of undocumented immigration and this shouldn't surprise you because I've been the mayor for a long time and outspoken on this issue, even nationally, I happen to agree with that."

"I think New York City should not deal with undocumented immigrants in a harsh way. I think they make a big contribution to the life of the city and were much better off being sensible and practical about it," he continued. "And the reality is that restaurants are going to have a certain number of people who are undocumented, you know people that come here to make a living trying to help themselves and their families."

In 1996, Giuliani sued the federal government over a provision in a welfare law that said any city or state employees could not be prevented from reporting someone's immigration status to the federal Immigration and Naturalization Service. Giuliani argued at the time that the provision was a direct attack on New York City's Executive Order 124, which prohibited city employees from reporting the immigration status of an undocumented immigrant unless they were suspected of a crime. The court ruled against Giuliani.

"For those who may not know, 'Executive Order 124' is New York City's policy regarding undocumented immigrants," said Giuliani in an October 1996 statement . "This order was issued seven years ago by Mayor Ed Koch and then later reissued by Mayor Dinkins and then by me. 'Executive Order 124' protects undocumented immigrants in New York City from being reported to the U.S. Immigration and Naturalization Service while they are using City services that are crucial for their health and safety, and critical for the health and safety of the entire city. I know 'Executive Order 124' offends some people. They ask, 'Why should we pay to provide services for illegal immigrants?' The answer is it's not only to protect them, but to protect the rest of society, as well."

In a speech at Harvard around the same time in 1996, Giuliani forcefully argued for the city's right to "protect the health and well being of our city" by shielding undocumented immigrants from the federal government.

"The Tenth Amendment provides that 'The powers not delegated to the United States by the Constitution, nor prohibited by it to the states, are reserved to the states respectively, or to the people,'" said the mayor in a speech at Harvard shortly before filing suit. "One right not granted to the federal government is the right of state and local governments to provide for the health and safety of their local communities. This right is generally described as 'the police power.' When Ed Koch signed 'Executive Order 124' it was a classic example of New York City's police power being used to protect the health and well being of our city."

"Most likely, the federal government will reply that controlling immigration is one of their core functions. But this is a disingenuous argument," he continued. "The federal government will be forced to argue that it has to treat undocumented immigrants unfairly in order to discourage others from coming here. Attempting to control immigration by creating a disincentive for a woman to report to the police that she has been beaten up by her husband is a very weak argument. And it's a horrible position for the federal government to take."