"When he first announced it he said, 'Muslim ban,'" the former New York mayor told Fox News late Saturday when asked whether the ban was connected to religion.
"Show me the right way to do it legally," Giuliani -- who Trump has tapped as his cyber security guru -- said the US president told him.
The 72-year-old said he and a team of legal experts "focused on -- instead of religion -- danger!" when they drafted the immigration crackdown that has sparked a global outcry and mass protests.
Giuliani said those predominately Muslim countries were targeted because they are "the areas of the world that create danger for us."
More From This Section
"Which is a factual basis, not a religious basis," he said.
The crackdown on Muslim immigration has infuriated civil rights groups and activists.
A federal judge blocked part of Trump's ban yesterday, ordering authorities not to deport refugees and other travelers detained at US airports.