Border security and illegal immigration continue to be among the most divisive issues our nation faces – and at times it seems like Democrats and Republicans will never agree on what to do. But in 2013 the U.S. Senate passed a bill that, though it died in the House, could serve as a model for effective immigration legislation that might pass and be signed into law – if all sides are willing to make reasonable compromises.

The 2013 bipartisan bill would have provided $46 billion for border security improvements. That’s nearly double the $25 billion President Trump is now pressing for to build the wall on our border with Mexico.

“Build that wall, build that wall, build that wall,” President Trump’s ardent supporters chanted Saturday night at a campaign rally in Lewis Center, Ohio, where the president campaigned for a Republican U.S. House candidate running in a special election Tuesday.

The president told the crowd that he will make sure the wall along our border with Mexico is built, to fulfill a promise he made repeatedly during his own campaign in the 2016 presidential race. He is clearly determined to get funding for the wall as one of his top priorities.

Immigrants crossing our border with Mexico would have covered much of the expense of building the wall under the 2013 legislation because they would each be charged $2,000 in fines, paid gradually, to earn permanent legal status.

But President Trump upset many of his fellow Republicans in Congress, who are generally supportive of his get-tough crackdown on illegal immigration, when he tweeted July 29: “I would be willing to ‘shut down’ government if the Democrats do not give us the votes for Border Security, which includes the Wall! Must get rid of Lottery, Catch & Release etc. and finally go to system of Immigration based on MERIT! We need great people coming into our Country!”

The threat of a government shutdown is certainly something many Republican members of Congress would rather avoid, since they would likely be held politically responsible in the Nov. 6 midterm elections.

But fortunately, if congressional Republicans and the president are willing to practice “the art of the deal,” reviving the 2013 Senate bill would give them a proven way forward – one that would fund border security, end the diversity visa lottery, and shift to a merit-based immigration system with the support of a substantial number of Democratic votes in Congress.

Immigrants crossing our border with Mexico – who comprise a slight majority of the roughly 11 million immigrants in the U.S. unlawfully – would have covered much of the expense of building the wall under the 2013 legislation because they would each be charged $2,000 in fines, paid gradually, to earn permanent legal status.

Far from the free grace of amnesty, the 2013 bill required those who had either crossed our border or overstayed a visa illegally to make amends. The legislation also provided protection for immigrants brought to the U.S. in violation of the law as children – the Dreamers, who President Trump has said include “some absolutely incredible kids” who should have a pathway to citizenship.

And, of course, under the legislation any immigrant with serious criminal convictions would be denied any chance to stay here with legal status.

The 2013 bill would have ended the diversity visa lottery altogether and terminated certain family reunification visas, including for siblings of U.S. citizens and for their married children older than 31.

By eliminating these visas and significantly increasing the number of visas for immigrant workers who could meet key needs in the U.S. labor market, the legislation sought to dramatically shift the availability of visas toward the merit-based process President Trump has praised.

Many in President Trump’s evangelical base would support such a move. Most evangelicals tell pollsters they support a path to citizenship for the undocumented, paired with border security improvements. A mere 16 percent of evangelicals are opposed.

Every Democrat in the Senate voted for this bill five years ago, joined by a significant number of Republicans. Certainly, many Democrats disliked particular elements of the bill, including what they viewed as unnecessary spending on border security and eliminating certain visa categories. But they were willing to accept these provisions in exchange for an earned legalization program.

Some wonder if Democrats would take the same deal today, allowing President Trump to simultaneously fulfill several key campaign pledges to his base and accomplish something Latino voters have seen as a priority for decades, but which both President George W. Bush and President Obama failed to make happen.

Indeed, when President Bush last pushed a similar immigration deal, some Senate Democrats inserted poison-pill amendments that helped kill a carefully crafted agreement, denying Bush a key legislative victory.

It’s possible such partisan brinksmanship would re-emerge if President Trump were to propose something along the lines of the Senate’s 2013 bipartisan deal today – but he should at least call the Democrats’ bluff.

There is, however, significant evidence that the Democrats would be willing to agree to the compromise legislation they supported five years ago – but the president’s best interests are continually sabotaged from within.

All but three Senate Democrats already voted for $25 billion for a border wall last February in exchange for a path to citizenship for Dreamers. But the bill failed when congressional Republicans were scared away by a presidential veto threat, courtesy of White House Domestic Policy Adviser Stephen Miller.

Miller, who advocates cutting legal immigration in half, urged President Trump to reject the deal because it did not include elimination of family reunification visas and the diversity visa lottery.

If President Trump is personally committed to cutting legal immigration and deporting all undocumented immigrants, there is simply no deal to be had, at least with this Congress. But if he truly is opposed to a net reduction in legal immigrant visas – as he explicitly stated last year – he needs to take the reins and ignore the staffers who have torpedoed congressional negotiations.

Many in President Trump’s evangelical base would support such a move. Thousands of evangelical pastors have affirmed an Evangelical Statement of Principles for Immigration Reform very consistent with the 2013 Senate bill, and most evangelicals tell pollsters they support a path to citizenship for the undocumented, paired with border security improvements. A mere 16 percent of evangelicals are opposed.

The president’s fellow business leaders are on board as well. The U.S. Chamber of Commerce strongly supported the 2013 effort, because it would be enormously beneficial to the economy. The Congressional Budget Office estimated that, over the course of 20 years, the bill would reduce federal deficits by about $900 billion, raise Americans’ wages by 0.5 percent and increase the nation’s gross domestic product by more than 5 percent.

We now have two options in front of us. If the president goes with the status quo, we’ll see yet another federal government shutdown – a move that could cost President Trump the House and Senate majorities in the November elections that he needs to govern effectively.

But if President Trump brings his famous deal-making skills into play, he can solve a problem that his predecessors have been unable to solve. That would give him something worth tweeting about.