The Home Office unlawfully ignored warnings that changes to immigration rules would create "serious injustices" for the Windrush generation, a report by the equalities watchdog says.
It found the "hostile environment" policy, designed to deter "irregular" migrants from settling, had harmed many people already living in the UK.
The Windrush generation came from the Caribbean to the UK from 1948 to 1971.
The Home Office said it was determined to "right the wrongs suffered" by them.
Labour said ministers should be "deeply ashamed" of the report's findings.
An estimated 500,000 people living in the UK make up the surviving members of the Windrush generation.
They were granted indefinite leave to remain in 1971, but thousands were children who had travelled on their parents' passports.
Because of this, many were unable to prove they had the right to live in the country when hostile environment immigration policies - demanding the showing of documentation - began in 2012, under Theresa May as home secretary.
This adversely affected their access to housing, banking, work, benefits, healthcare and driving, while many were threatened with deportation.
The Equality and Human Rights Commission's (EHRC) report found a "lack of organisation-wide commitment, including by senior leadership, to the importance of equality and the Home Office's obligations under the equality duty placed on government departments".
It added: "Any action taken to record and respond to negative equality impacts was perfunctory, and therefore insufficient."
The report also said: "From 2012, this [hostile environment] agenda accelerated the impact of decades of complex policy and practice based on a history of white and black immigrants being treated differently."
The EHRC recommended that, to ensure "measurable action", the Home Office should enter an agreement with it by the end of January 2021, involving "preparing and implementing a plan" of "specific actions" to "avoid a future breach".
This should apply to its immigration work "in respect of race and colour, and more broadly", it said.
The Home Office has agreed to enter an agreement with the EHRC.
The commission's interim chair, Caroline Waters, said: "The treatment of the Windrush generation as a result of hostile environment policies was a shameful stain on British history.
"It is unacceptable that equality legislation, designed to prevent an unfair or disproportionate impact on people from ethnic minorities and other groups, was effectively ignored in the creation and delivery of policies that had such profound implications for so many people's lives."
In a statement, Home Secretary Priti Patel and Home Office permanent secretary Matthew Rycroft said they were "determined to right the wrongs suffered by the Windrush generation and make amends for the institutional failings they faced, spanning successive governments over several decades".
They added that the department was already applying a "a more rigorous approach to policy making" and would "increase openness to scrutiny, and create a more inclusive workforce".
It was also launching "comprehensive training" for all staff "to ensure they understand and appreciate the history of migration and race in this country", they said.
But Satbir Singh, chief executive of the Joint Council for the Welfare of Immigrants, said campaigners had "repeatedly warned the Home Office that their hostile environment policies would inevitably lead to serious discrimination and to the denial of rights, particularly for people of colour".
He added that "successive home secretaries" had "ignored these warnings" before the situation hit the headlines in 2018.
For Labour, shadow home secretary Nick Thomas-Symonds said: "Ministers must work urgently to rectify this, including getting a grip of the Windrush compensation scheme, which has descended into an offensive mess, piling injustice upon injustice."
And shadow justice secretary David Lammy, who organised the cross-party letter referring the Home Office to the EHRC last year, said: "Black Britons were detained, deported, denied healthcare, housing and employment by their own government because of the colour of their skin.
"Since the scandal broke, the Home Office has only paid lip service to its victims. It must now urgently rectify this gross injustice."