When President Donald Trump told Axios this week that he plans to sign an executive order to end the right to citizenship for children born to noncitizens living in the United States, he stirred up long-standing arguments in both the political and legal spheres.

He also injected a new campaign issue into one of Texas’ tightest races, the contest between U.S. Sen. Ted Cruz and Democratic challenger Beto O’Rourke for U.S. Senate.

As has become familiar on immigration issues, the two are diametrically opposed: Cruz has long called for ending birthright citizenship, while O’Rourke championed the policy as an expression of “our core national values.”

Cruz said birthright citizenship, which is rooted in the 14th Amendment, encourages “birth tourism” in which women come to the United States during the final weeks of their pregnancy in order to secure citizenship for their offspring.

"Virtually every country on Earth doesn't allow children of those there illegally to become citizens automatically," Cruz said Tuesday at a campaign stop in Uvalde. "That isn't a policy that makes any sense.”

Birthright citizenship is a thorny political issue. But from a legal perspective, experts say, it’s mostly cut and dried. The widely held legal consensus is that birthright citizenship is a right enshrined in the U.S. Constitution’s 14th Amendment, which guarantees equal protection under the law. An 1898 U.S. Supreme Court case ruled that a child born in San Francisco to Chinese parents was a citizen. If birthright citizenship were ended through an executive order, then, a legal challenge would be all but guaranteed.

As recently as 2011, Cruz — a former Texas solicitor general who has argued before the U.S. Supreme Court nine times — seemed solidly on board with that consensus.

“The 14th Amendment provides for birthright citizenship. I’ve looked at the legal arguments against it, and I will tell you, as a Supreme Court litigator, those arguments are not very good,” Cruz said in an interview during his first bid for U.S. Senate. “As much as someone may dislike the policy of birthright citizenship, it’s in the U.S. Constitution.”

But on Tuesday, Cruz dodged the legal question, telling a Dallas Morning News reporter, “I would need to examine the legal arguments behind an executive order, and I haven’t seen those yet.”

Legal experts have said, in a near-unanimous chorus, that Trump cannot merely end a long-recognized right with the stroke of a pen.

For his part, O'Rourke has never called for ending birthright citizenship. On the contrary, he has said he supports a path to citizenship for children brought to the U.S. illegally.

"Not only must we protect the Fourteenth Amendment and our core national values that we are a country comprised of immigrants and asylum seekers the world over, but we must also protect the 200,000 Dreamers contributing to our communities across Texas from the fear of deportation,” O’Rourke said Tuesday in a statement to The Texas Tribune.

He's repeatedly said he's against a border wall and has called for the end of "the militarization of ICE" — Immigration and Customs Enforcement — and for officials to "renew our commitment to refugees and asylum seekers."

"Recognizing we are a nation of laws — one that can maintain order at the border without dehumanizing anyone — we have to put a stop to family separation, ensure that every separated family is reunified, pass the DREAM Act, provide immigrants with a fair path to work and citizenship, close private detention centers, end the militarization of ICE, renew our commitment to refugees and asylum seekers and ensure that everyone who comes to this country can contribute to their full potential," O'Rourke said.

At an MSNBC town hall Tuesday evening in Houston, O'Rourke questioned the timing of Trump's comments on birthright citizenship.

"Interesting that he drops this proposal with a week to go until the Nov. 6 election," O'Rourke said. "I think he’s trying to play upon the worst impulses of this country instead of speaking to our ambitions, our hopes, our dreams — those things that we can achieve if we all come together. So I don’t know what he’s trying to do, but I just know the task left to us, which is to be the answer to that."

Asked at the town hall if he opposes amending the Constitution to get rid of birthright citizenship, O'Rourke replied, "Absolutely I do."

Patrick Svitek contributed to this report.