Former President Barack Obama on Wednesday sparked controversy when he accused “evangelical Hispanics” who voted Republican of ignoring President Trump putting migrants in “cages” — although Obama himself overlooked his own administration’s record on detention.

"People were surprised about a lot of Hispanic folks who voted for Trump, but there’s a lot of evangelical Hispanics who, the fact that Trump says racist things about Mexicans, or puts undocumented workers in cages, they think that’s less important than the fact that he supports their views on gay marriage or abortion," he said on "The Breakfast Club" radio show.

OBAMA TAKES SHOT AT EVANGELICAL HISPANICS WHO VOTED FOR TRUMP DESPITE 'RACIST' RHETORIC 

The controversy over migrants, specifically children, being put in “cages” while in detention centers has been a political hot potato for years, with both Republicans and Democrats assigning the blame to the other side.

The term “cages” refers to chain-linked fences in detention centers that separated migrants, often by age and sex. Those facilities in places like Arizona and Texas were built during the Obama administration as part of its effort to curb a growing crisis at the border.

While many migrant activists objected to the detaining of migrants in those facilities during the Obama administration, the controversy grew during the Trump administration with a new border crisis in 2019 -- with many of those criticizing the Republican administration of not realizing that many of the images came from the prior administration.

JOE BIDEN, GRILLED ON OBAMA-ERA RECORD OF PUTTING CHILDREN IN 'CAGES,' ARGUES 'WE KEPT THEM SAFE' 

Last year, Democrats on the House Oversight Committee deleted tweets that promoted an upcoming hearing on “kids in cages” after being called out for using Obama-era images of migrants in detention to highlight current conditions at the border.

Obama-era Homeland Security Secretary Jeh Johnson said at the time that the facilities weren't ideal but were one of the ways authorities dealt with a surge of immigrants that had to be transferred to Health and Human Services (HHS) within 72 hours.

"During that 72 hour period, when you have something that is a multiple — like four times of what you're accustomed to in the existing infrastructure, you've got to find places quickly to put kids," he said in 2019, before suggesting the alternative was putting them on "the streets."

But often the debate about what alternatives there are to detention, and how (if at all) child migrants should be separated in a detention center, has descended into trading blame for the situation in the first place.

“They built the cages. Who built the cages Joe?” Trump asked then-candidate Joe Biden in an October presidential debate.

On Wednesday, The Washington Post reported that one of the facilities in South Texas where chain-link enclosures were set up is to close down to undergo renovations. 

CLICK HERE TO GET THE FOX NEWS APP

The Post reported that the partitions will be removed and the center redesigned and reopened in 2022. While facilities are relatively empty now, because of a Centers for Disease Control and Prevention (CDC) order allowing the administration to quickly return migrants to their home countries, the Post notes that the move could leave border authorities without a large-volume facility if there is a border surge next year.

Fox News' Sam Dorman and Gregg Re contributed to this report.