Immigration policy has been one of the most contentious issues in Congress in recent years. And a big part of that debate has revolved around President Donald Trump’s proposed border wall.

Generally, Democrats have been skeptical that a wall is needed or would work as an immigration-control measure. But Democratic senators who are up for election this year in Republican-leaning states have had to walk a political tightrope, balancing their party loyalty with their constituents’ support for the president.

In an ad in his reelection campaign, Sen. Joe Manchin, D-W.Va., said, “I wanted Mexico to pay for the wall, but they’re not. So we need to do it ourselves.”

Despite attacks by Republicans accusing him of being soft on illegal immigration, Manchin said in the ad, “I voted to fund President Trump’s wall. Check the vote.”

So we did.

The clearest example — and the one Manchin visually highlighted in his ad — was a bill sponsored by Sen. Chuck Grassley, R-Iowa. Among other things, it would have funded a border wall.

Specifically, the legislation said that “the Secretary of Homeland Security shall take such actions as may be necessary (including the removal of obstacles to detection of illegal entrants) to construct, install, deploy, operate, and permanently maintain physical barriers, tactical infrastructure and technology in the vicinity of the United States border to achieve situational awareness and operational control of the border and deter, impede, and detect illegal activity in high traffic areas.”

The measure also would have struck the language in an existing bill that said “fencing and road Improvements” and instead inserted “physical barriers” — a stronger phrase, closer to the vision of a “wall.”

“Not later than September 30, 2022, the Secretary of Homeland Security, in carrying out this section, shall deploy along the United States border the most practical and effective physical barriers and tactical infrastructure available for achieving situational awareness and operational control of the border,” the legislation said.

The legislation included other elements of Trump’s immigration agenda, including tighter curbs on legal immigration, that made it unpalatable to most Democrats.

Trump backed this measure, and three Democrats ended up voting for it when it came up on Feb. 15, 2018, along with 36 Republicans. That was well short of a majority and much less the 60 votes required to advance the measure to a final vote.

But Manchin was one of those three Democrats to vote for it.

In two other instances, Manchin voted for measures that would have increased border security infrastructure such as fencing, but not precisely the wall as envisioned by Trump.

One was a bipartisan measure, informally called the Common Sense Plan, that would have implemented a path to citizenship for “dreamers” who were brought illegally to the United States as minors, along with funding for border security. Despite the border-security language, Trump opposed it.

The measure would have provided $25 billion for “the construction of physical barriers, border security technologies, and tactical infrastructure.” It said that within six months after passage, the executive branch would have to submit to Congress “a risk-based plan for improving security along the borders of the United States, including the use of personnel, fencing, other forms of tactical infrastructure, and technology.”

It won the backing of eight Republicans and 46 Democrats and Democratic-caucusing independents. Manchin voted to advance the measure to a final vote. However, it fell short of the 60 votes required for final passage.

third measure — and the only one to pass — was a $1.3 trillion annual federal government spending bill, of which funding for replacement border fencing was a small part.

Trump has sometimes touted this bill as making progress on building his border wall, but we have found these claims inaccurate, because the law was actually explicit about providing funding for items outside the scope of the Trump wall. The bill included $1.6 billion for some projects at the border, but none of that can be used toward the border wall promised during the presidential campaign.

The final vote for this bill was 65-32 in favor. All told, 39 Democrats voted for it, including Manchin.

It can be tricky to pin down what pieces of legislation supported Trump’s specific vision for the wall, and which supported more generic elements of border security.

However, the bill Manchin highlighted in his ad — the Grassley legislation — received Trump’s support, so Manchin’s vote for it was effectively a vote for Trump’s border-security vision, however it might play out on the ground. This supports Manchin’s notion that he “voted to fund President Trump’s wall.”

Manchin’s overall message is a shift from Trump’s first year in office.

Morrisey’s office forwarded us a link to an article that listed a number of instances in which Manchin spoke out against, or expressed skepticism about, the idea of a border wall. For instance, the article noted that in an interview on “The Young Turks” on July 11, 2017, Manchin said, “I’m not for building a wall. I’m not for building a wall at all.” He also told Politico that month that he had “not been supportive of funding for a wall.”

Our ruling

Manchin said, “I voted to fund President Trump’s wall.”

Manchin has offered various opinions about the merits of a border wall over time. However, when it came to votes, we found a clear instance in which Manchin supported a Trump-backed, hard-line immigration bill with border wall provisions that was too conservative even for a sizable portion of the Republican caucus.

We rate the statement Mostly True.

This story was originally published by PolitiFact.