President Trump’s push to get Congress to fund his proposed border wall officially converged with his 2020 reelection campaign here on Monday night, as the president and potential Democratic challenger Beto O’Rourke staged dueling rallies in this vibrant border city.

The two events along the U.S.-Mexico border encapsulated the fierce debate over illegal immigration and border security that has been roiling Washington and is emerging as a flash point in the presidential campaign.

At the start of a consequential week at the U.S. Capitol, where congressional negotiators are seeking to avoid another government shutdown, the president tried to use the backdrop of O’Rourke’s hometown to argue that a wall would help protect border communities.

With four days to go before a partial government shutdown, Trump took Air Force One to the border in an attempt to gain a political advantage in an immigration debate that polls show he has been losing.

In a meandering, 75-minute speech, Trump tried to paint an image of crime and lawlessness on the border while claiming falsely that violent crime went down in El Paso after a wall was built.

“We need the wall, and it has to be built, and we want to build it fast,” he said. Pausing to listen to chants of “Build that wall!,” Trump sought to correct his supporters: “Now, you really mean finish the wall,” he said, claiming that his promised border wall was already under construction.

He referred to O’Rourke several times during the rally, calling the former congressman “a young man who’s got very little going for himself.” Trump claimed O’Rourke’s rally was poorly attended and that his 2018 election loss to Sen. Ted Cruz (R-Tex.). should disqualify him from seeking higher office.

“How about Beto?” Trump said, during a lengthy screed attacking Democrats over policies he labeled as “socialism.” “Beto was defeated, too. But he suffered a great defeat.’’

Hours before the president arrived, thousands of his supporters — many of them wearing red campaign hats — lined up outside the El Paso County Coliseum, where they were entertained by live music. The early crowd was heavily Hispanic — perhaps the most diverse group the president has ever attracted to a rally.

The crowd included many local Republicans who said they were excited to see so many like-minded people gather in such a liberal area to support the president and the wall. There were also Trump supporters who drove for hours to get to the rally from elsewhere in Texas and from New Mexico.

The rowdy crowd repeatedly burst into chants of “USA! USA!” and “Build that wall!” to drown out several demonstrators who interrupted Trump multiple times.

Beyond the wall: Dogs, blimps and other things used to secure the border

About a mile down the road, several thousand demonstrators gathered at a high school carrying American flags, rainbow banners, “Beto for President” flags, and flags for Mexico and Texas. There were also signs decrying Trump and his border wall — such as “Trump made America hate again” — and chants from the crowd that included “Make tacos, not walls!”

O’Rourke — who has disagreed vehemently with Trump’s depiction of El Paso as crime-ridden before construction of a border fence — has pointed to statistics showing that the city was one of America’s safest long before the fencing was installed a decade ago. Local officials also have said that the physical barrier has had no impact on the city’s relatively low rate of violent crime.

The clash in El Paso came as Trump and some of his Democratic opponents are engaging each other directly in the run-up to a general election that is more than 600 days away.

Trump traded words with Democratic Sens. Elizabeth Warren (Mass.) and Amy Klobuchar (Minn.) over the weekend as they announced their presidential campaigns.

On Monday, the president sharply attacked Democrats, calling them “the party of socialism, late-term abortion, open borders and crime.” For the first time, he singled out the “Green New Deal” — a climate-change action plan backed by several presidential contenders — saying it would virtually eliminate air travel.

“To pave the way for socialism, Democrats are calling for massive tax hikes and the complete elimination of private health care,’’ he said. “They’re coming for your money and they’re coming for your freedom.”

Trump saved his most direct attacks for O’Rourke, who is among a growing group of contenders directly challenging Trump over immigration and other issues.

Another government shutdown could further harden battle lines. Key lawmakers said they had reached an agreement late Monday with enough time to secure House and Senate approval this week and avoid another shutdown. Government funding for several agencies is set to expire Friday. And it’s not clear whether Trump, who is considering declaring a national emergency over border security, would ultimately support any deal reached by Congress.

Trump has often played the role of spoiler after lawmakers reach bipartisan agreements, and he has been dismissive of the negotiations. On Monday, Trump said he had not yet heard the details of the tentative agreement, but he said it would not matter because he would build the wall one way or another.

“As I was walking up to the stage, they said that progress is being made with this committee,” Trump told his El Paso crowd. “Just so you know, we’re building the wall anyway.”

Trump alluded to building the wall by declaring a national emergency, which would trigger executive authority to reallocate federal funds for wall construction, by telling rallygoers, “We’re setting the stage. We’re setting the table.”

The president’s past attempts at compromise have been met with fierce backlash from conservative radio and television hosts, whose opinions Trump follows closely. Trump was scheduled to do an interview with Fox News’s Laura Ingraham while in El Paso.

Trump’s demands for money to build a border wall, which prompted the last partial government shutdown, are not the central sticking point now. Instead, Democrats’ push for new restrictions on immigrant detentions has led to the stalemate.

Trump’s campaign released a video before the president’s visit featuring El Paso residents who claimed that fencing has improved safety in their community.

O’Rourke offered a direct contrast to Trump’s rhetoric during his opposing rally less than a mile away from the president’s event. On Friday, O’Rourke published a Medium post laying out his argument for why Trump’s characterization of El Paso is wrong and why a wall is not needed, along with 10 proposals for immigration policy.

“The President, using the same racist, inflammatory rhetoric of years past, seeks to build a wall, to take kids from their parents, to deploy the U.S. Army on American soil, to continue mass deportations and to end the protection for Dreamers,” wrote O’Rourke, who has said he will decide by the end of this month whether to run for president.

Trump has been needling his potential Democratic challengers over their support for policies including Medicare-for-all, higher taxes on the wealthy and the Green New Deal.

“Amy Klobuchar announced that she is running for President, talking proudly of fighting global warming while standing in a virtual blizzard of snow, ice and freezing temperatures,” Trump said Sunday on Twitter. “Bad timing. By the end of her speech she looked like a Snowman(woman)!”

Klobuchar, whose presidential announcement came during snowfall in Minnesota, shot back, asking how Trump’s “hair would fare in a blizzard.”

Ever since Trump won the White House, Democratic strategists have been searching for a better way of dealing with his name-calling and attacks. During the 2018 midterm elections, pollsters advised that it was more important to reintroduce the party’s views on key economic issues than to attack the president.

But the challenge for candidates in the 2020 presidential primary is different, as both Trump and the Republican Party have embarked on systematic efforts to tease them individually and brand the Democratic Party as socialist, extreme and threatening to the American way.

Klobuchar’s hair-focused response showed one approach, which has also been employed by Warren, who has called Trump a “loser,” a “thin-skinned fraud” and a “large orange elephant in the room.”

Jill Normington, a Democratic pollster who is not working for a presidential campaign, said polling shows clearly that the top priority for Democratic primary voters is finding a candidate who will defeat Trump, although there is not yet any agreement on what qualities will make that happen.

“What you are seeing in the candidates’ response to how to deal with Trump is how undefined ‘electability’ is,” Normington said. “Some of them are choosing to engage the president directly. Some of them are choosing to engage from a geographic standpoint, some from a temperament standpoint, some from an adversarial standpoint.”

Olorunnipa reported from Washington. Michael Scherer in Washington contributed to this report.