Anyone who doubts that incumbent Sen. Ted Cruz is taking his Democratic challenger, Beto O’Rourke, seriously need only consider Cruz’ latest request: he is asking President Donald Trump to please campaign for him in Texas—which is a big change from the days when Cruz and Trump were at each other’s throats.

Here’s why Cruz is obviously somewhat nervous: a recent Texas Lyceum poll showed him ahead of O’Rourke by only 2% in the Texas Senate race, which is a statistical dead heat given the poll’s margin of error. Other recent polls haven’t been quite that favorable to O’Rourke; Real Clear Politics, factoring in different polls, finds that Cruz has an average lead of 6.5%. But in a state as Republican-controlled as Texas, Cruz should be ahead by double digits. And Cruz knows that, which is why he is seeking the help of someone he expressed nothing but contempt for in 2016.

When Cruz and Trump were competing for the GOP presidential nomination in 2016, the bad blood between them was much nastier than anything on the Democratic side with Hillary Clinton and Vermont Sen. Bernie Sanders. Clinton and Sanders’ primary debates grew testy at times, but their competition for the Democratic presidential nomination never reached the level of bitterness and ugliness of the Cruz/Trump rivalry—not by a longshot. Clinton and Sanders’ most heated exchanges were downright polite compared to the insults that Cruz and Trump exchanged on the campaign trail in 2016.

Trump dismissed Cruz as “Lying Ted,” repeated a conspiracy theory involving Cruz’ father (Cuban-born Rafael Cruz) and the assassination of President John F. Kennedy, and insulted his wife, Heidi Cruz more than once. And Cruz, in response, told Trump, “It’s not easy to tick me off. I don’t get angry often. But you mess with my wife, you mess with my kids, that’ll do it every time. Donald, you’re a sniveling coward. Leave Heidi the hell alone.”

In 2016, Cruz denounced Trump as everything from a “pathological liar” and a “serial philanderer” to “utterly immoral.” And Trump, trying to woo the Christian Right, once implied that Cruz’ Cuban heritage made it impossible for him to be a true Protestant evangelical. “To the best of my knowledge,” Trump told a crowd in Iowa, “not too many evangelicals come out of Cuba, OK? Just remember that, OK? Just remember.”

The implication from Trump was clear: Cruz might look white and have fair skin, but he’s still Hispanic—and therefore, he’s not to be trusted. In 2016, Republicans weren’t exempt from Trump’s racism by any means.

When Cruz spoke at the Republican National Convention on July 21, 2016, he was booed for not endorsing Trump. Eventually, however, Cruz gave Trump his endorsement—although it seemed insincere given the bad blood between them. Sanders, in contrast, aggressively campaigned for Clinton after conceding to her in the Democratic presidential primary and urged his supporters to vote for her when he spoke at the Democratic National Convention in Philadelphia.

Times change. Cruz and Trump at least pretended to bury the hatchet after Trump was sworn in as president in January 2017. And even though Cruz has the advantage in Texas’ 2018 U.S. Senate race, he obviously isn’t taking any chances—if Trump can fire up the far-right Republican base in the Lone Star State, Cruz welcomes his help.

Before 2017, O’Rourke was not well-known nationally. The 45-year old Democrat—an Irish-American who speaks fluent Spanish—served on the city council in El Paso, his home town, from 2005-2011 before being elected to the U.S. House of Representatives in Texas’ 16th district in 2012. But after he announced, in 2017, his candidacy for the U.S. Senate, O’Rourke began receiving a lot more national attention—and he has been way ahead of Cruz in terms of fundraising. While Cruz raised $4.6 million during 2018’s second quarter, O’Rourke raised $10.4 million.

O’Rourke’s longshot campaign has exceeded expectations in a major way. And when Cruz spoke at far-right blogger Erick Erickson’s Resurgent Gathering conference in Austin on August 4, the 47-year-old senator told the crowd, “We do have a real race. We are taking it deadly serious.”

Although O’Rourke knows he is fighting an uphill battle—Cruz defeated Democrat Paul Sadler by 16% when he was elected to the U.S. Senate in 2012—Texas’ politics and demographics are more nuanced and complex than a lot of pundits realize. Many of Texas’ major cities lean Democrat, including Houston, Austin, Dallas, San Antonio and O’Rourke’s home town of El Paso. And in those cities, Democratic mayors and city council members have been plentiful. Houston has elected one Democratic mayor after another and hasn’t had a Republican mayor since the late Jim McConn left office in the early 1980s.

But at the state level, things become much more challenging for Democrats in Texas—where the state legislature is dominated by Republicans. Texas’ last Democratic governor was the late Ann Richards, who was voted out of office when she lost to Republican George W. Bush in 1994. And while Democrats represent parts of Texas in the U.S. House of Representatives, Texas Republicans have had a clear advantage in U.S. Senate races.

To outsiders, Texas’ demographics are surprising in light of its reputation for being a hardcore Republican state. Non-Hispanic whites are now a minority in the Lone Star State, comprising only 42% of the population in 2010. In Texas, Trump received 62% of the white male vote and 52% of the white female vote, but Hillary Clinton fared better among Texas’ non-Anglo voters with 94% of the black female vote, 82% of the black male vote, 63% of the Latino male vote and 69% of the Latina vote.

But elections come down to turnout above all else, and according to Texas Monthly, Latinos accounted for only 19% of Texas’ voter turnout in 2016. In Texas, the GOP is great at getting its base—older, whiter, more rural—to the polls in big numbers. And that is an obstacle O’Rourke needs to overcome in November.

Cruz, despite having the upper hand in the U.S. Senate race, hasn’t ruled out the possibility that O’Rourke might actually manage to pull off an upset in November—and by asking Trump to campaign for him, Cruz is hoping that his one-time rival can help spare him that fate.