Sen. Bob Casey, D-Pa., is facing criticism from his Republican opponent for images in a campaign ad that show the border wall as his campaign touts his efforts to secure the southern border despite his past opposition to wall construction, which Casey has called "a waste of money."

A recent ad by Casey says he has "voted repeatedly to secure the border" and has voted "25 times to secure the border." During the spot, the backdrop on the screen shows the border wall and what appears to be Trump-era wall construction.

The move is similar to moves by the Harris campaign, which has also shown images of the border wall in its ads despite shutting down most wall construction.

TEXAS DEM'S SENATE AD FEATURES BORDER WALL HE ONCE BLASTED AS 'RACIST' 

Bob Casey ad

This screenshot shows an ad by Sen. Bob Casey's campaign (Screenshot)

But the vulnerable Democratic senator has a history of mostly opposition rather than support for the wall. In 2019, he said "building a wall is a waste of money" and that the U.S. should be "investing in border infrastructure and security technology at ports of entry, where most illegal smuggling happens."

"President Trump doesn’t seem to get it. He’s not getting a concrete or steel wall along the width of the border — never, ever, ever, ever," Casey said on X.

"If President Trump is serious about stopping illegal drugs, then he should stop talking about building an ineffective wall and start talking about hiring more people and beginning 24-hour surveillance of vehicle screenings," Casey said in an interview the same year.

Casey also voted against a border security deal that would have combined permanent status for young illegal immigrants who came to the U.S. as children in exchange for border wall funding. 

The Biden administration halted border wall construction in early 2021 after entering office. Casey’s votes suggest support for that move. He repeatedly voted against measures introduced by Republicans that blocked the cancellation of wall contracts. He has also voted against the House GOP border security bill, which included border wall funding, and against an amendment in 2022 to replace funding for a chief readiness support officer with $500 million for border wall construction.

CLICK HERE FOR MORE IMMIGRATION COVERAGE

Bob Casey, Dave McCormick

Republican Senate candidate Dave McCormick, right, believes Pennsylvania voters are realizing the importance of the 2024 election. (Reuters I Associated Press)

Fox News Digital has previously reported that Casey supported a border fence in 2006 but later voted against a number of fence-related funding amendments in the years after that.

This year, Casey has thrown his support behind a bipartisan border security measure that would have increased funding to the border and would limit asylum entries into the U.S. It has found support with the Biden administration, including Vice President Kamala Harris. The bill includes a limited amount of border wall funding, but only a fraction of the billions that had been requested by former President Trump.

Dave McCormick, the Republican challenging Casey for his Senate seat, accused him of lying about his record in the ads.

"Bob Casey is yet again lying to the commonwealth. He's weak and desperate to cover up his extreme record of opposing a wall, supporting open borders and enabling the flood of fentanyl pouring into the country," McCormick said in a statement to Fox News Digital. "Pennsylvanians are sick of the liberal hypocrisy and ready for a strong leader who will fight every day to finish the wall, secure the border and protect our communities."

The Casey campaign defended his record on the border, pointing to his support of a bipartisan 2013 immigration reform bill by the ‘’Gang of Eight" that included adding 700 miles of fencing to the border along with other measures, including a pathway to citizenship for some illegal immigrants.

HARRIS DOUBLES DOWN ON SUPPORT FOR LEFT-WING BENEFIT FOR ILLEGAL IMMIGRANTS: ‘SMART SOLUTIONS’

Dave McCormick

McCormick accused Casey of lying about his record. (Getty Images)

It also pointed to broader border security votes Casey has made, including voting for electronic verification systems, emergency funding for security and Border Patrol hiring, a 2023 appropriations bill that included $10.7 billion in border security funding and a 2021 amendment to create a deficit-neutral reserve for immigration enforcement.

"Sen. Casey has voted more than 25 times to secure our border, working with Republicans to add physical barriers, hire more Border Patrol agents and invest in border security technology to stop the illegal flow of fentanyl and keep Pennsylvanians safe," spokesperson Kate Smart said.

The campaign also noted McCormick’s opposition to the bipartisan bill introduced this year. McCormick called that legislation a "capitulation" and said it would solidify high levels of illegal immigration.

CLICK HERE TO GET THE FOX NEWS APP

"David McCormick opposed the toughest border security bill in modern history that was backed by Border Patrol agents and written by members of his own party because he cares more about playing petty politics than keeping Pennsylvanians safe," Smart said.

The ad is not the only wall-related ad controversy in the Senate race. Rep. Colin Allred, D-Texas, featured the southern border wall in a recent Senate campaign ad despite having previously claimed the wall proposed by former President Trump was "racist." 

Fox News' Andrew Mark Miller contributed to this report.