In a surreal and curious exchange at the final presidential debate, Donald Trump seemed to try to ally himself with President Obama on immigration enforcement, as Hillary Clinton seemed to try to compare her stance with Trump’s. The moment highlighted just how strange and complicated the politics of immigration are—even in a presidential cycle that has been historically stupid.

Trump opened the immigration portion of the night by telling moderator Chris Wallace that he will deport criminal undocumented immigrants and immediately tighten border security if elected.

“We have some bad hombres, and we’re going to get them out,” he said.

Clinton then ripped Trump’s plan for mass deportation, calling it “an idea that would rip our country apart.” But, she then added, she and Trump aren’t entirely opposed on the issue.

“I have been for border security for years,” she said. “I voted for border security in the United States Senate, and my comprehensive immigration reform plan, of course, includes border security. I want to put our resources where I think they’re most needed: getting rid of any violent person, anyone who should be deported, we should deport them.”

Depending on what day of the week it is, Trump is partially on the same page as Clinton regarding deportations. His immigration policy proposal says he will prioritize deporting violent criminals and undocumented immigrants who have overstayed their visas (upward of 4 million people). Clinton doesn’t say she will look to deport that second group of people—a huge difference between the two candidates—but the two candidates seem to be aligned on criminal undocumented immigrants.

Then, curiously enough, Trump argued that Clinton agrees with him on the wall.

“Hillary Clinton wanted the wall,” he said. “Hillary Clinton fought for the wall in 2006 or thereabouts. Now, she never gets anything done, so naturally the wall wasn’t built. But Hillary Clinton wanted the wall.”

That isn’t quite true—but it’s not 100 percent false, either. Clinton did vote for a 700-mile border fence in 2006. Trump’s proposed wall would be 1,000 miles long.

Clinton fired back by saying she would try to legalize non-criminal undocumented immigrants, and cited the fact that Trump used undocumented workers on construction projects as evidence they need better protections.

Then—again, weirdly—Trump invoked Obama to…criticize Clinton? It wasn’t totally clear.

“President Obama has moved millions of people out,” he said. “Nobody knows about it. Nobody talks about it. But under Obama, millions of people have been moved out of this country. They’ve been deported. She doesn’t want to say that, but that’s what has happened.”

Trump’s claim is correct. Obama has deported millions of undocumented immigrants—upward of 2.5 million—much to the chagrin of immigration attorneys, who argue many of these deportees, particularly those from violent Central American countries, should have been treated like refugees, not pariahs.

Still, Trump has spent most of his presidential campaign arguing that Obama refuses to enforce immigration laws. So his turnaround on the president is a bit of a head-scratcher.

In reality, Clinton’s immigration policies would likely be a continuation of Obama’s. She’s defended the deportation of undocumented children and voted for a biometric entry-exit system to monitor whether tourists and businesspeople visiting the U.S. stay longer than allowed.

Immigration policy is complicated. It’s also extremely important, and affects every sector of this country’s economy, as well as the lives of millions of legal and undocumented immigrants. But you wouldn’t have gathered that from the discussion at the debate, which was a muddled hodge-podge of mess.