WASHINGTON — Foes have painted him as a darling of the coastal elites. But if Rep. Beto O'Rourke is sweating about that line of attack, he shrugged it off long enough to spend Wednesday evening in Manhattan — yukking it up on late-night TV and raking in cash from New Yorkers eager to turn Texas blue.

Andy Cohen, executive producer and public face of Bravo's Real Housewives franchise, headlined a $500 per head reception for O'Rourke, who is locked in a tight battle to unseat Sen. Ted Cruz.

That came after the El Paso Democrat's gig on Late Night with Stephen Colbert, where he fielded softball questions about border security and revealed an impatience for providing citizenship to young immigrants brought into the country illegally as children.

"We don't need a wall," he said when Colbert prompted him to discuss his views on border security and immigration. "We can have smart security solutions and we can free Dreamers from the fear of deportation by making them US citizens today, so they can contribute to their maximum capacity, to their full potential."

"Today" would represent an unusually aggressive time frame. President Donald Trump scrapped the Obama-era program known as Deferred Adjudication for Childhood Arrivals, or DACA, ending the executive order that shielding so-called "Dreamers" from the threat of deportation. O'Rourke has long voiced support for the Dream Act, which would codify DACA into law and provide an eventual -- years-long -- path to citizenship for immigrants who had lived in the United States for a certain period and stayed out of trouble.

Even if he was referring in shorthand to that proposal, his language could provide fodder to Cruz and other conservatives who portray him as dangerously radical.

"Looks like Beto took his extreme message where it actually resonates--to the New York and Hollywood celebrities who champion amnesty and open borders. He should be running alongside Cynthia Nixon and Andrew Cuomo, rather than in the Lone Star State where the rule of law and securing our borders actually matter," Cruz spokeswoman Catherine Frazier said late Wednesday after the show aired.

"We don't need a wall" says Texas Senate candidate @BetoORourke in his conversation with @StephenAtHome on tonight's #LSSC. Tune in at 11:35/10:35c for the full interview! pic.twitter.com/lBmK46g1L3 — The Late Show (@colbertlateshow) September 13, 2018

Colbert rolled out the welcome mat for O'Rourke and pulled few punches in mocking Cruz.

Noting that Lt. Gov. Dan Patrick quietly visited the White House earlier this summer to implore Trump to come to Texas and stump for Cruz, Colbert quipped: "You know it's bad when you need backup from a man with a 36 percent approval rating. Their backup plan to that is a celebrity endorsement from the herpes virus."

Later, during a seven-minute chat with O'Rourke between segments with Keira Knightley and Martha Stewart, he asked if it seemed "surreal" to see Cruz and Trump, bitter rivals during the 2016 primaries, join forces against him.

We've been told that Hollywood is afraid of being outdone by New York after last night's fundraiser, so now they're pulling out all the stops... #TXSen #DontCaliforniaOurTexas pic.twitter.com/Bak8D9sfGW — Ted Cruz (@tedcruz) September 13, 2018

"Yeah this is going to be interesting," the Texan replied. But he said, "The people of Texas are more than a match for President Trump or for politics as usual."

"People are coming out at this moment of truth," he added, as Colbert gave him a chance to spill his campaign spiel. "They're going to help us decide as a country: Are we a nation of walls? Will we ban all Muslims or all people of one religion? Will we describe the press as the enemy of the people? Will we take kids away from their parents when they're trying to claim asylum, fleeing the most brutal countries in this hemisphere if not the planet? Or are we going to be defined by out ambitions, the big things that we want to do."

The Colbert appearance came just a week after another liberal host, Ellen DeGeneres, provided O'Rourke another friendly platform and national exposure. She invited him onto The Ellen Show after his impassioned defense of NFL players who kneel during the national anthem went viral.

Cruz has used that issue to inflame his own supporters. On Wednesday, he released a new version of an ad featuring Tim Lee, a Texan who stepped on a landmine while serving in Vietnam as a Marine.

"I gave two legs for this country. I'm not able to stand, but I sure expect you to stand for me when the national anthem is being played," Lee says. The narrator then asks: "In November, where will you stand?"

Cruz sought to blunt any bounce O'Rourke might get from the Colbert appearance by buying advertising time during the show in a number of Texas markets. Colbert noted the ad buy and called it a sign that he's scared.

"I assume it's for Cruz's campaign, and not his patented line of reptile moisturizers, Cruz's Oozes. 'No more dry leg, Johnny Iguana,' " Colbert joked. "Cruz does seem moist all the time."

Colbert's poked fun at Cruz and Republicans for "attacking" O'Rourke by spreading photos of him from his punk rock days, and even a DUI booking photo that only made him seem even more cool, and attractive.

The senator and his challenger are locked in a tough battle that could reshape Texas politics for a generation. Democrats haven't won a statewide race since 1994, and O'Rourke has defied expectations by smoking past Cruz in fundraising and battling to a tie, or close to it, in opinion polls.

Immigration is one of a host of issues on which they disagree strongly. O'Rourke is vehemently opposed to President Donald Trump's vision of a vast border wall and has argued that there is already too much fencing between the United States and Mexico. Cruz supports the wall.

The entertainment industry clearly leans toward the Democrat. On Wednesday, his campaign posted an invitation for a concert featuring Willie Nelson on Sept. 29 in Austin.

Willie Nelson, seen her on April 4, 2017, in Nashville, Tenn., will headline a concert for Rep. Beto O'Rourke in Austin on Sept. 29. (Jason Davis / Getty Images for SiriusXM)

Nelson famously enjoys marijuana, and O'Rourke advocates for decriminalization.

The entertainment industry apparently thinks #Beto has a chance. Bless their hearts. Bi-coastal fundraising will not mean a thing on a debate stage with #TedCruz. (By the way, to both camps-- can we get that going?) https://t.co/J3zFFSy9iy — Mark Davis (@MarkDavis) September 13, 2018

O'Rourke grew up in El Paso but is no stranger to Manhattan, having graduated from Columbia University in 1995.

From the Ed Sullivan Theater on Broadway, where Colbert tapes his show, it's about a 20-minute taxi ride to The Cutting Room, a concert venue where the O'Rourke campaign organized a fundraising reception.

CNBC obtained an invitation and first reported on it.

Cruz has used talk shows to reach a national audience, too.

He appeared on The Tonight Show during the 2016 presidential campaign, even taking part in a sketch with host Jimmy Fallon playing the part of his nemesis, the future president.

In June, Cruz beat another host, Jimmy Kimmel, in a one-on-one game of basketball after Kimmel had taunted him for being a blobfish.

Almost exactly three years ago — ahead of the first primaries of 2016 — Cruz appeared on Colbert's show. Colbert challenged the senator to square his admiration for Ronald Reagan with his own relative unwillingness to compromise.

"You're a religious man. ... Would you believe that it's important not to call the other side the devil?" Colbert asked then. "Absolutely. There's nothing diabolical about you," Cruz quipped.

When some in the audience hissed and booed at Cruz for arguing states have the power to refuse marriage licenses to same-sex couples, Colbert had to shush them: "No no no no no. Guys, guys. However you feel, he's my guest, so please don't boo him."

Colbert has used Cruz has a punching bag plenty of times since then. Just after the March primaries, he quipped in his opening monologue, "You may not have heard of Beto O'Rourke, but no candidate gets voters more excited than 'Not Ted Cruz.' "

He went on to lacerate the senator for a jingle that attacked O'Rourke as a gun-grabbing, open border-loving leftist. The opening line of the jingle offended him the most: "If you're gonna run in Texas, you can't be a liberal man/Cause liberal thought is not the spirit, of a Lone Star man."

"You can't rhyme man with man, you monster," Colbert said in that March show. "What are you doing? Have you no shame?"

Cruz has bashed O'Rourke as a darling of Hollywood. Appearances such as those with DeGeneres, who tapes in Burbank, and Colbert, whose show's home is on the other coast, provide fuel for that perception. Taking direct help from Cohen, the Bravo personality, will magnify that even further.

The senator has gone out of his way to use New York itself as a foil.

Stumping on Saturday near Houston, he joked that New Yorkers can't possibly know what Texas needs because they pronounce it "How-stun" instead of Houston (Hew-stun) and Humble with a hard H (like hush) instead of "Umble."

During the 2016 primaries, Cruz played to southern sensibilities by deriding Donald Trump's "New York values" — a line of attack that would come back to haunt him when it turned out the race was still raging by the time New York's primary came around.