The "hostile environment" policy brought in against illegal immigrants when Theresa May was Home Secretary was seen as "almost reminiscent of Nazi Germany" by some in government, the former head of the civil service has said.
Lord Kerslake's explosive comments came as campaigners for families caught up in the Windrush generation immigration papers controversy have called for a review of the highly contentious initiative.
Crossbencher peer Lord Kerslake, who was in charge of the civil service between 2012 and 2014, said deep concerns about the "hostile environment" policy were expressed across government.
He told BBC2's Newsnight: "I think it was not just a question of the Home Secretary being told it was a challenging policy, the prime minister was as well.
"This was a very contested piece of legislation across government departments.
"Now, I can't say, and shouldn't say, as the former head of the civil service, precisely who gave what advice to whom. But, what I can tell you, it was highly contested and there were some who saw it, I shan't name them, as almost reminiscent of Nazi Germany in the way it's working."
Asked if he was referring to people in the civil service, Lord Kerslake said: "No, some of the ministers were deeply unhappy."
Pressed on whether the government could say that experts did not warn them a Windrush generation problem could be a consequence of the move, Lord Kerslake said: "Look, I don't think they can say that really.
"You created an environment in which action was going to be taken and there was a risk, it was obvious to everyone, that you would take the rough with the smooth. I think it would be just quite wrong to land this on the civil service, basically.
"This was a conscious policy in order to hold on to a strong policy position that was proving very difficult to imply."
Lord Kerslake said it was "completely ridiculous" for Home Secretary Amber Rudd to try to blame civil servants for the Windrush situation.
"You cannot create a climate and then not expect it to have consequences."
Mrs May faces calls for an independent review of immigration policies, including the "hostile environment" initiative.
The Home Office has said the number of Windrush cases being investigated had surged to 113.