Donald Trump’s plan to force the Mexican government to pay for a border wall contains provisions authored by Kansas Secretary of State Kris Kobach, who said he has advised the campaign on immigration.

The GOP frontrunner has followed Kobach’s lead in proposing how to pay for the wall, a primary promise of Trump’s campaign.

Trump’s proposal to force Mexico to pay for the wall — halting the flow of remittances from the U.S. into Mexico — matches and expands upon the method Kobach, a Republican, put forward when he endorsed Trump in February.

Trump has promised to build a wall that would snake along the 2,000-mile-long U.S.-Mexico border since the beginning of his campaign. Constructing the barrier would be a vast undertaking.

Trump has floated differing cost estimates, and outside groups have placed estimates at more than $10 billion. This past week, the candidate told The Washington Post in a memo, also published on his campaign website, how he would pay for it.

In an interview, Kobach said Trump’s focus on remittances — money sent by individuals in the U.S. to friends and family in other countries — is consistent with what he had been advising the campaign. He said he has spoken with the campaign directly, and Trump himself, about immigration.

"Mr. Trump was receptive to that idea and I think he’s an excellent negotiator and he looks for opportunities to put pressure on opposing parties in negotiations and this fits the bill," Kobach said.

The plan involves gaining financial leverage over the Mexican government to induce it to pay the cost of the wall. Trump would use a provision of the Patriot Act, passed in the aftermath of the Sept. 11, 2001, attacks, to include money transfer companies, such as Western Union, under the definition of financial institutions, opening them up to requirements that customers prove their identity before opening accounts.

In turn, the federal government could require money transfer companies to refuse customers who seek to wire money outside the country unless they can prove lawful residency in the U.S.

Remittances from the U.S. to Mexico total more than $20 billion a year. Trump is banking on the hope that the Mexican government would opt to pay the potentially $10 billion one-time cost of the wall instead of deprive its citizens billions in remittances annually.

According to the Trump campaign, if Mexico pays for the wall, the rule blocking remittances without proof of residency wouldn’t go into effect.

Mexico has taken advantage of the U.S. through gangs, drug traffickers and cartels that exploit the country’s porous border, Trump maintains.

"The United States has borne the extraordinary daily cost of this criminal activity, including the cost of trials and incarcerations. Not to mention the even greater human cost. We have the moral high ground here, and all the leverage," the memo says.

The path outlined by Trump is a more detailed version of what Kobach proposed in February when he endorsed the candidate. During an interview Friday, when directed to Trump’s plan on his campaign website, Kobach said he had drafted portions of the document. The Trump campaign didn’t respond to a request to elaborate on Kobach’s involvement with formulating Trump’s position on paying for the wall.

"I have been in touch with Mr. Trump directly and his campaign team about this issue," Kobach said.

The payment proposal for the wall has drawn derision since it was disclosed by the campaign last week. Critics point to the economic impact of blocking remittances and say hardball tactics will strain relations with Mexico.

President Barack Obama called the proposal "half-baked." The idea, he told reporters in Washington, was primarily put forward for political consumption. Many remittances are made by legal immigrants, he said, who are sending money to their families.

"The notion that we’re going to track every Western Union bit of money that’s being sent to Mexico — good luck with that," Obama said.

The U.S. Hispanic Chamber of Commerce called the proposal a direct assault on the money transfer industry, which it said is thriving.

"Trump’s proposal is the height of hypocrisy as a Republican candidate who has rebuked executive orders and big government," the chamber’s president and CEO, Javier Palomarez, said in a statement.

"At the end of the day, people will continue to send money to Mexico and other parts of the world. Trump would replace our current system, with its transparency and technological advances, with a shadow economy."

Kobach was the only Kansas statewide elected official to endorse Trump ahead of the state’s GOP caucus in March. Texas Sen. Ted Cruz won the state.

In Kansas, attention on Kobach often focuses on the proof of citizenship voter registration requirement he has pushed for while secretary of state, as well as his new power to prosecute voter fraud (his office has filed a handful of cases, so far resulting in one conviction and the dismissal of another). But he also has built a reputation nationally for a hard-line stance on illegal immigration.

Kobach played roles in developing and defending immigration laws in Arizona and Alabama. He also is involved in litigation defending various local immigration measures across the country.

That history makes Trump a natural choice for Kobach. Immigration has been a key theme of Trump’s campaign, and the candidate has spoken about the issue more frequently — and in more aggressive tones — than other candidates.

Trump’s comments on immigration have proven divisive since the very outset of his candidacy, when he said Mexican immigrants bring drugs, crimes and are rapists, while also saying he assumed some are good people.

Though Trump remains in the lead in the GOP contest, his campaign has shown signs of faltering in recent weeks. His campaign manager was charged with battery in Florida after allegedly grabbing the arm of a reporter at a campaign event. And Trump said women who have an abortion should be punished — a comment he later walked back.

Trump also lost the Wisconsin GOP primary last week. His second place finish in the state increases the chances he will be unable to win the delegates needed to secure the nomination through the primary and caucus process — leading to a contested, and possibly chaotic, national convention.

Kobach said Friday he remains confident in his endorsement. One of Trump’s greatest strengths is his ability to attract people who haven’t previously been involved in the political process, Kobach said.

"A lot of that is due to the Trump effect, where he’s bringing in people who have been completely absent from political involvement and participation in elections," Kobach said.