Just a week before the midterm elections, President Donald Trump said he might eliminate birthright citizenship -- the longstanding policy that virtually anyone born on U.S. soil has citizenship. And he said he could use an executive order to do it.

It’s an idea that Trump had publicly floated before. But he’s never before been so clear about using an executive order.

"It was always told to me that you needed a constitutional amendment. Guess what? You don't," Trump told Axios in an interview released on Oct. 30. "You can definitely do it with an act of Congress. But now they're saying I can do it just with an executive order."

Because this will ultimately be a question for the Supreme Court to resolve, we won’t put it to the Truth-O-Meter. But experts say that Trump’s assertion that he could use an executive order to overturn birthright citizenship is almost certainly wrong.

"If it's mandated by the Constitution, it can only be undone by a constitutional amendment," said Peter J. Spiro, a professor at Temple University Law School. "If it's mandated by statute, it can only be undone by a subsequent statute. It's only if it's mandated by neither that Trump could do it by executive order."

And most legal experts agree that birthright citizenship is bolstered by both the Constitution and by statute.

The legal underpinnings of birthright citizenship

The notion of birthright citizenship can be traced back as far as 1608 with a British decision in Calvin’s Case, a decision that became part of the common law adopted in the early days of the U.S. legal system. Calvin’s case granted subjectship -- a British concept that has since evolved into citizenship -- to all children born in Scotland except those of diplomats and enemy troops in hostile occupation.

There are three key pieces of legal precedent underpinning birthright citizenship, scholars say.

First, there’s the Fourteenth Amendment to the Constitution. The relevant portion says that "all persons born or naturalized in the United States, and subject to the jurisdiction thereof, are citizens of the United States and of the state wherein they reside."

This amendment "was unquestionably intended to cover the children of unauthorized migrants, namely the children of enslaved persons brought here by criminals after the prohibition of the slave trade," said Gabriel (Jack) Chin, a law professor at the University of California-Davis.

Second, there’s a 1952 statute (8 U.S. Code § 1401) that echoes the language in the Fourteenth Amendment. "The following shall be nationals and citizens of the United States at birth: (a) a person born in the United States, and subject to the jurisdiction thereof," the statute reads in part.

And third, there’s an 1898 Supreme Court decision, known as the Wong Kim Ark case. In its 6-2 majority decision, the justices ruled that Wong -- and others born on United States soil, with a few clear exceptions -- did indeed qualify for citizenship under the 14th Amendment.

"The Fourteenth Amendment affirms the ancient and fundamental rule of citizenship by birth within the territory, in the allegiance and under the protection of the country, including all children here born of resident aliens. … The Amendment, in clear words and in manifest intent, includes the children born, within the territory of the United States, of all other persons, of whatever race or color, domiciled within the United States."

Legal scholars added that the longstanding application of birthright citizenship is itself a strong argument for keeping it in place.

The "consistent, systematic, and unbroken historical practice" is a strong argument against Trump’s view, Spiro said. "For at least a century, the government has extended citizenship to the children of parents present in the United States in violation of the immigration laws. That practice counts for purposes of constitutional interpretation and statutory interpretation."

The importance of the phrase "subject to the jurisdiction thereof"

The wiggle room that exists for opponents of birthright citizenship involves the qualifier "subject to the jurisdiction thereof" -- wording that appears in both the constitutional amendment and the statute.

Traditionally, this phrase has been interpreted to exclude only the U.S.-born children of foreign diplomats or of enemy forces engaged in hostilities on U.S. soil. But those skeptical of the legal basis for birthright citizenship say that the Supreme Court has never specifically ruled on whether the children of illegal immigrants would qualify for birthright citizenship, since that wasn’t at issue in the Wong Kim Ark case. (Read more about this aspect of the Wong Kim Ark case.)

The same window holds for the drafters of the Fourteenth Amendment, legal experts say. "Because there weren't any federal immigration controls at the time the amendment was adopted in 1868, there's no direct evidence how the drafters intended it to apply to that category," Spiro said.

John C. Eastman, a law professor at Chapman University, has written that this provides a path for overturning birthright citizenship. He wrote that undocumented immigrants, like foreign tourists, "are subject to our laws by their presence within our borders, but they are not subject to the more complete jurisdiction envisioned by the Fourteenth Amendment as a precondition for automatic citizenship."

For this reason, Eastman argues, the ruling in Wong Kim Ark "does not mandate citizenship for children born to those who are unlawfully present in the United States."

Many legal scholars disagree with this logic.

"Illegal aliens and their children are subject to our laws and can be prosecuted and convicted of violations – unlike diplomats, who enjoy certain immunities, and unlike foreign invaders, who are generally subject to the laws of war rather than domestic civil law," Ilya Shapiro has written for the libertarian Cato Institute. "The illegal immigrants’ countries of origin can hardly make a ‘jurisidictional’ claim on kids born in America, at least while they’re here. Thus, a natural reading of ‘subject to the jurisdiction’ suggests that the children of illegals are citizens if born here."

Could it be overturned by executive order?

It might be possible to overturn birthright citizenship by passage of a new statute, though even that’s a minority view among legal scholars, said Jennifer M. Chacón a law professor at the UCLA School of Law. (She believes it would require a constitutional amendment.)

But even if that were possible, the notion that an executive order could accomplish it -- as Trump argues -- is dubious, legal experts said.

The president would effectively be "offering his interpretation" in an executive order, and this "tees up the lawsuit that will get the Supreme Court to rule, once and for all, what it means," said Mark Krikorian, executive director of the Center for Immigration Studies, a group that generally supports a tighter immigration system.

Kermit Roosevelt, a University of Pennsylvania law professor, agreed. Ending the practice of birthright citizenship "is something the president cannot accomplish by executive order," he said. The most the administration could do is "argue for its preferred interpretation in litigation. Executive orders can’t amend statutes."

The most that Trump could do is sign such an executive order with the clear expectation that opponents would sue to block its implementation. After that, it would be up to the courts to decide the ultimate outcome.