Bernie Sanders once railed against the effects of the 2007 immigration bill and its guest-worker program on American workers and wages, and seemed to lament the lack of sanctions on employers for hiring undocumented immigrants in a video posted to what was then his Senate website.

"Unfortunately, the guest-worker provisions in this bill, which will bring many hundreds of thousands of lower-wage workers into this country will only make a bad situation even worse," Sanders says in the video.

"I believe we have very serious immigration problems in this country," he said, later in the video. "I think as you've heard today, sanctions against employers who employ illegal immigrants is virtually nonexistent. Our border is very porous."

While he says he supports a pathway to citizenship for undocumented immigrants, he says the 2007 bill would do more harm than good. Sanders was speaking on June 20, 2007, before the bill failed. Eight days later, he posted similar remarks in a statement after the bill had failed.

As Hillary Clinton has attacked Sanders for his vote against the 2007 immigration bill in the Senate, he's argued the bill's guest-worker program was terrible for the guest workers.

"Included in that legislation was a guest-worker provision, which organizations saw as almost akin to slavery," he said on Thursday night at a CNN town hall.

But in 2007, as has been pointed out over the last several months, Sanders talked about the guest-worker program in terms of its effect on the American worker, including in a video posted to his own website.