No 2020 presidential candidate has been more progressive on immigration issues than former U.S. Housing Secretary Julián Castro, who wants to decriminalize unauthorized border crossings, provide free health care to undocumented immigrants and says he’s open to tearing down existing sections of border barriers.

Castro again used the issue to pillory Democratic frontrunner Joe Biden at the debate Thursday night at Texas Southern University in Houston, saying the former vice president wants to “take credit for Obama’s work but not have to answer to any questions” about controversies like immigration enforcement while he was in the White House.

But the San Antonio Democrat, who also served under President Barack Obama, hasn’t always been a liberal darling on the border issues that have animated so much of the conversation on the campaign trail.

In 2013, while testifying before the Republican-led Congress, Castro gave a full-throated endorsement of the border and immigration policies advocated by Obama — who critics labeled the “deporter in chief” for his aggressive immigrant removal policies — and touted the completion of enforcement measures that included fencing along the U.S-Mexico border.

“Under this administration, there has been tremendous progress with regard to enforcement,” Castro, then-mayor of San Antonio, told the House Judiciary Committee in February 2013 in response to a question from then-U.S. Rep. Bob Goodlatte, a Republican, on whether interior enforcement should play a role in discouraging undocumented immigrants from crossing the U.S. border. “In fact, the triggers in the 2007 proposal have just about all been met. But going forward, of course, enforcement is part of the conversation.”

The “triggers” in that 2007 proposal — which were supposed to be enacted before immigrants could get “amnesty” for being in the country illegally — included vehicle barriers and “370 miles of border fencing,” plus the “detention until removal of 100% of aliens apprehended on the Southwest border” and enough detention beds to accommodate at least 31,500 undocumented migrants per day, according to a 2013 Congressional Research Service report.

Ruth Ellen Wasem, the author of the report and now a professor of policy practice at the University of Texas at Austin’s LBJ School of Public Affairs, said the triggers were put in the proposed bipartisan 2007 legislation to assure opponents of legalization that “enforcement was ratcheted up” before unauthorized residents in the country could gain lawful status.

“Even progressive Democrats like Obama recognized that, in order to have the votes to enact immigration reform, you’d have to demonstrate that the matter of undocumented migration had been addressed and was under control,” Wasem said.

During the 2013 hearing, the main rub was whether undocumented immigrants who are already here would be put on a pathway to citizenship or, as Castro put it, forced to become “second-class non-citizens.”

“I do believe that a pathway to citizenship should be the option that the Congress selects,” Castro said at the time. “I don’t see that as an extreme option.”

But when it came to “border security,” Castro endorsed more “boots on the ground” at the border and enhanced “interior enforcement” — which refers to the removal of undocumented immigrants from inside the country.

“I am very pleased that … what has been proposed by the president and the Senate includes stronger interior enforcement,” Castro said. “Both in terms of border security and interior security, comprehensive immigration reform gives us the opportunity to make this work better.”

Castro wasn’t available to comment, but his spokesman Sawyer Hackett said Friday afternoon that the former mayor was not giving his blessing to the most controversial aspect of Obama’s immigration policies.

“He was applauding the administration’s effort to prioritize immigration enforcement, not their efforts to deport mass numbers of immigrants,” Hackett said.

When the subject of free health care for undocumented immigrants came up, Castro didn’t endorse it, but instead embraced the status quo, saying “they don’t qualify for traditional welfare or health care,” so he considered that issue “resolved by the law that is in place.”

By 2014, some Latino groups were up in arms over some of Obama’s immigration policies, sharply criticizing the president for the number of deportations that took place under his watch. During an annual dinner event that year, the president of The National Council of La Raza — who said she considered Obama to be “the deportation president” — questioned whether his legacy was at stake.

A month later, during a panel in Austin, Castro too said he wasn’t “comfortable” with the number of deportations. At the time, Castro wasn’t yet a member of Obama’s administration, but he was considered a rising star in the Democratic party after being named the Democratic National Convention’s keynote speaker in 2012.

“My hope is that his administration will go about it in a different way. I’m not comfortable with the number of deportations,” Castro said during the April 2014 panel. “My hope is that, just like he did with [easing childhood deportations], the president will find ways that are within his power, that are constitutional, to ease the level of deportations.”

Castro’s immigration platform has shifted dramatically since he threw his hat in the ring to challenge President Donald Trump. Immigration reform has become his signature issue on the trail, and several times during the primary he’s lambasted fellow Democrats who have taken more moderate stances on the issue.

Fast forward to 2019, and Castro has touted an immigration plan that has received plaudits from progressive candidates like U.S. Sen. Elizabeth Warren. The main component of his plan includes repealing of that part of U.S. immigration law, Section 1325, which deals with unauthorized border crossings. (During that same hearing in 2013 he said “open borders” — which he now dismisses as a “right-wing talking point” — were extreme. “Nobody agrees with open borders,” he said at the time).

With regard to interior enforcement, Castro has also taken a more lax stance. During a Q&A with The Atlantic, the former HUD secretary said he has called for specific changes for how enforcement in the interior would be done.

“For instance, right now they have the authority to, within a 100-mile radius of the border — you know, 100 miles that stretch from any point on the border — to do interior checks and enforcement, and I believe that power has been abused,” Castro told the publication.

Hackett, the Castro spokesman, said deportations “will occur in a Democratic administration,” but in that scenario, “efforts would prioritize people who actually pose a threat and not people who have lived here for years” and made the U.S. their home.

Some immigration experts say Castro’s change is emblematic of how Democrats are running to the left of their party’s base. Cristobal Ramón, senior policy analyst with the Immigration Project at the Bipartisan Policy Center, said the progressive wing has “pushed the party towards being more critical of this part of the enforcement system over the last ten years, starting in the Obama era and reaching mainstream status in the Trump era.”

“Castro tried to push Biden on Obama’s record,” Ramón said. “If he’s going to make that claim, then he’s going to have to make sense of what he said in 2013. It’s not necessarily this incredibly strong support of the Obama Administration’s enforcement actions, but it’s certainly not a critique.”

Hackett, meanwhile, said the big difference between Castro and Biden is that the former housing secretary “had learned the lessons of the past on immigration reform,” while Biden has not.

“Secretary Castro, unlike some candidates running in 2020, has learned the lessons of the past on immigration reform, including that no amount of deportations will bring Republicans to the table to negotiate,” Hackett said.

Disclosure: Texas Southern University and the University of Texas have been financial supporters of The Texas Tribune, a nonprofit, nonpartisan news organization that is funded in part by donations from members, foundations and corporate sponsors. Financial supporters play no role in the Tribune's journalism. Find a complete list of them here.