Democratic presidential candidate Joe Biden, who has been critical of President Donald Trump's immigration policies, previously expressed similar views, saying a barrier at the southern border was needed to stop "tons" of drugs from coming into the United States.

Speaking to a South Carolina rotary club in November 2006, then-Sen. Joe Biden (D., Del.) touted his support for the Secure Fence Act, a bill that authorized "700 miles of double-layered fence on the border through more than a billion dollars in appropriations," CNN reported Friday. Biden made the comments in the run-up to his failed presidential bid in 2008.

"Folks, I voted for a fence, I voted, unlike most Democrats—and some of you won't like it—I voted for 700 miles of fence," Biden told the group. "But, let me tell you, we can build a fence 40 stories high—unless you change the dynamic in Mexico and—and you will not like this, and—punish American employers who knowingly violate the law when, in fact, they hire illegals. Unless you do those two things, all the rest is window dressing."

"Now, I know I'm not supposed to say it that bluntly, but they're the facts, they're the facts," Biden continued. "And so everything else we do is in between here. Everything else we do is at the margins. And the reason why I add that parenthetically, why I believe the fence is needed does not have anything to do with immigration as much as drugs."

"And let me tell you something folks," he added, "people are driving across that border with tons, tons, hear me, tons of everything from byproducts for methamphetamine to cocaine to heroin, and it's all coming up through corrupt Mexico."

Biden's comments may prove to be an obstacle in the crowded 2020 Democratic primary, as he faces several progressive Democrats who have been vocal against a border wall and have supported sanctuary cities.

CNN noted that Biden's previous comments are similar to Trump's current positions on border security and sanctuary cities, and that he could face backlash from some of his fellow Democratic opponents. Andrew Bates, a spokesman for Biden, said the former vice president wants border security but to get there without "abandoning our values."

"As then-Senator Biden said at the time, ‘we can build a fence 40 stories high,' but it will not address the real issues here. Vice President Biden believes we have to stop trying to scare people and instead have an immigration discussion based on facts," Bates said. "He believes that we can secure our borders without abandoning our values, and that we should do that by addressing the root causes of immigration abroad and working toward comprehensive immigration reform at home, including a pathway to citizenship for undocumented immigrants and smart border security. He also believes that the Trump administration's approach to immigration, including its crackdown on sanctuary cities and especially its repugnant treatment of migrant children, is contrary to our values as a nation."