It was a foundational promise of Donald Trump's historic presidential campaign: Mexico would pay for his 2,000 mile border wall. But as he desperately fights for $5.7 billion in taxpayer money for the project, Trump now claims he never said Mexico would directly foot the bill.

"Obviously, I never said this and I never meant they're going to write out a check," the president told reporters Thursday at the White House.

He did say it - at least 212 times during his campaign and dozens more since he took office. And he put it in writing - in a March 2016 memo to news outlets and then posted to his campaign website.

Specifically, Trump threatened to cut off billions of dollars in remittance payments from Mexican nationals in the United States to families in their home country. That, he proclaimed, would pressure the Mexican government to cough up "a one-time payment of $5-10 billion" for the wall.

Experts said at the time that the plan would not work and the Trump administration never tried to enact it. But 2 1/2 years later, with the parts of the federal government shut down for three weeks in a budget impasse over Trump's wall, the episode illustrates how his routine application of falsehoods, exaggerations and lies in service of political combat has come back to burn him.

First, former Mexican president Enrique Peña Nieto openly defied Trump and canceled two scheduled visits to the White House, one in 2017 and one in 2018, in retaliation for Trump's demands that Mexico pay.

"Mexico will not pay for any wall," he stated. His successor, Andrés Manuel López Obrador, has shown no willingness to change course.

The Republicans who controlled Congress over the last two years never made funding the wall with taxpayer dollars a priority.

And now during the shutdown, the White House is searching far and wide for potential pots of money it could tap as the president considers declaring the border a national emergency - a move that is sure to kick off a legal battle and inflame political tensions.

"The story keeps changing by the day - like everything," said Cecilia Muñoz, a vice president at New America, a liberal think tank, who served as White House domestic policy adviser under President Barack Obama. Of Trump's original plan for funding the wall, she added: "They had no earthly idea how they would get Mexico to do that so they came up with an idea to try to pass the laugh test, which they didn't do."

Trump and his aides have floated other ideas to pressure Mexico to pay - canceling visas or increasing processing fees for Mexicans and taxing imported goods at 20 percent. But the Mexican government has flatly refused.

Most recently, Trump has resorted to arguing that Mexico will indirectly pay through a revised trade deal his administration signed with Mexico and Canada. But that deal has yet to be ratified by Congress, contains no provision earmarking money for the wall and economists have doubted whether it would significantly increase revenue to the U.S. Treasury.

"Obviously, they're not going to write a check," Trump said of Mexico on Thursday, before departing Washington for a tour of a Border Patrol station in McAllen, Texas. "But they are paying for the wall indirectly, many, many times over, by the really great trade deal we just made."

News fact-checkers have poked holes in Trump's assertions. And Democrats have not been swayed, confident that the president is struggling to convince the public that his strategy to shut down the government for a publicly funded border wall is a political loser.

"Today is Thursday. That means @realDonaldTrump is lying, again," Rep. Ted Lieu, D-Calif., wrote on Twitter, referring to Trump's claim about Mexico. "Hard for Democrats to negotiate with @POTUS when he makes stuff up, changes his mind on a whim and lies repeatedly."

Trump has been promising that Mexico would pay for a wall since before he was a candidate for the White House and the vow figured prominently in his June 16, 2015, campaign announcement.

"I will build a great wall," he declared that day at Trump Tower in New York. "And I will have Mexico pay for that wall. Mark my words."

What might have seemed like a preposterous boast from a vanity candidate became a staple of his campaign rallies, where supporters chanted, "Build the wall!" Trump would often add: "Who's going to pay for the wall?" The crowd would respond: "Mexico!"

By the spring of 2016, after he had emerged as the front-runner for the Republican nomination, Trump was under pressure to explain how he would make good on the promise.

In the two-page policy memo, the Trump campaign described using powers under the Patriot Act to compel U.S. financial institutions to block personal remittances to Mexico, which totaled more than $20 billion a year.

Such money is an important source of income to many families in Mexico and other Latin American countries, experts said, and gives their economies a boost. For example, Muñoz recalled officials from El Salvador cautioned the Obama administration not to end a Temporary Protected Status program for tens of thousands of Salvadoran nationals living in the United States because sending them home would cut off those funds and seriously disrupt its economy.

"My first reaction was, 'That sounds counterproductive,'" said Andrew Seele, president of the Migration Policy Institute. "Mexican migration is dropping in part because Mexican migrants are sending money home so more Mexicans can have a dignified life."

Cutting off such a flow would potentially disrupt their lives and result in more migration from Mexico to the United States, he added.

Experts also said it was highly unlikely Mexican officials would have acquiesced to what would essentially have been a ransom demand from the Trump administration.

"No, it would have launched a trade war," said Manuel Orozco, an expert on migration and remittances at The Dialogue, a think tank that promotes democratic governance in Latin America. "If they tried to stop national assets in the U.S., the home country would do something retaliatory, and the implications would be far more devastating for the U.S. business sector than to Mexico."

White House officials did not respond to a request for comment Thursday.

In March 2017, Rep. Mike Rogers, R-Ala., introduced legislation to impose a 2 percent fee on electronic remittance transfers to Mexico and other Latin American countries - with the funds going toward Trump's border wall. The fee would have been limited to individuals, not businesses, and would cover U.S. citizens, legal permanent residents and unauthorized immigrants.

"I have long supported the border wall, which will protect Americans," Rogers said in unveiling the bill, which gained several co-sponsors. It was referred to the House Financial Services Committee, where it languished. A spokeswoman for Rogers did not respond to a request for comment.

Ironically, since Trump's election, remittance transfers have skyrocketed. In 2017, the amount of cash Mexicans in the United States sent home reached an all-time high at nearly $27 billion, an increase of nearly 9 percent from 2015.

Experts cited several factors, including that migrants were so fearful Trump's threats to crack down on immigration that they increased their transfer payments.

Looking back, Seele said the Trump campaign was "scrambling to figure out how Mexico would pay for the wall. It was a policy solution to a political statement."