A couple of days before Democrats caucus in Nevada, two of the nation’s top Latino political figures tore into Sen. Bernie Sanders’ immigration record, accusing the Vermont independent of peddling the “same-old Republican ant-immigration playbook.”

“Senator Sanders consistently wasn’t there when we needed him most,” said Julian Castro, the Housing and Urban Development secretary, in a conference call with reporters this afternoon. “He voted with the anti-immigrant right against immigrants.”

Mr. Castro and Congressman Luis Gutiérrez of Illinois, a national leader on immigration reform, spoke in a call organized by the Hillary Clinton presidential campaign. Both Clinton supporters, along with immigrant advocates, eviscerated Mr. Sanders for voting against an immigration reform bill in 2007 and voting to protect the Minutemen, a private militia which patrolled the Mexican border to keep immigrants from entering the United States illegally.

“The truth is, look, he was absent from most of the critical immigration debates,” Mr. Gutiérrez said. “Unfortunately, when he did show up, his record is troubling.”

Mr. Gutiérrez said that it was “just as troubling” that Mr. Sanders never “improved” his record in the years following his 2007 vote. “The question Latinos have to ask themselves is: where was Senator Sanders when we needed him most?”

“When we needed someone to stand up, Sanders was playing for the wrong team,” he added. “I want someone who is playing for the right team.”

The attacks on Mr. Sanders come as the self-described democratic socialist threatens to topple Ms. Clinton, the establishment front-runner, in Nevada, a state with a growing Latino population that was once viewed as a place where the Sanders campaign would fail. Instead, after nearly defeating Ms. Clinton in Iowa and blowing her out in New Hampshire, Mr. Sanders is outraising the former secretary of state and proving to be a formidable rival for the Democratic nomination.

On immigration, Mr. Sanders has taken troubling votes for progressives, though his record is more mixed than the Clinton camp suggests. The 2007 bipartisan bill, spearheaded by the late Sen. Ted Kennedy, eventually failed as other efforts have to provide a path to citizenship for undocumented immigrants. Mr. Sanders, who does support comprehensive immigration reform, opposed the bill on the grounds that it would expand the number of guest workers in the U.S. He feared these workers could drive down the wages of low-income Americans, who would be forced to compete with this cheap new influx of labor.

Immigration reform advocates were dismayed by this position. But the AFL-CIO, the largest coalition of labor unions in America, sided with Mr. Sanders. The Sanders campaign has also claimed since that he was concerned about the treatment of guest workers here.

Ms. Clinton and Mr. Sanders, both senators at the time, together supported an amendment regarded by Republican Sen. Jon Kyl, another leader in the effort, and Kennedy as a “poison pill,” though Ms. Clinton would ultimately vote in favor of the legislation and Mr. Sanders against. The amendment tweaked the bill’s guest work provisions in such a way to threaten the support of Republican and business interests.

Mr. Sanders’ Minutemen vote was more perplexing. Regarded as heroes by some conservatives and racist thugs by Democrats in border states, the private militia claimed American officials were tipping off the Mexican government about the whereabouts of their patrols. The militia found a sympathetic ear in some quarters of Congress, where Republican Jack Kingston of Georgia introduced an amendment barring the Department of Homeland Security from providing “a foreign government information relating to the activities of an organized volunteer civilian action group, operating in the State of California, Texas, New Mexico, or Arizona.”

The amendment sailed through Congress with the help of the GOP and some conservative Democrats—and Mr. Sanders, who in theory had no reason to weigh in because he represented a state nowhere near the Mexican border.

Defending the vote to BuzzFeed in December, Michael Briggs, a spokesman for Mr. Sanders, said the Vermont independent was just following the lead of Congressman Olav Sabo of Minnesota, a Democrat and ranking member on the Homeland Security Committee. Mr. Sabo said he was opposed but wouldn’t vote against the measure because it “apparently does nothing.”

“People put forward nuisance amendments all the time,” Mr. Briggs said. “In this case, the Customs and Border Patrol [according to Sabo] said it was a meaningless thing and [Sanders] and Sabo voted for it.”

This explanation, however, did little to appease and Mr. Gutiérrez and Mr. Castro, the former mayor of San Antonio.

“I’m convinced that if the past is any indication of what the future holds, Senator Sanders will continue to let us down,” Mr. Castro said.