President Donald Trump said he intends to pass an executive order that would end birthright citizenship to target immigrants.

Birthright citizenship is widely understood to be part of the 14th Amendment and would take a new constitutional amendment or Supreme Court ruling to invalidate.

In three historic cases, the Supreme Court has interpreted the amendment broadly.

President Donald Trump claims he has a plan to stop the United States from granting birthright citizenship. But if he tries to execute it, he'll almost certainly have to put up a fight in the Supreme Court.

Birthright citizenship is the right for anyone born in the US to be automatically granted US citizenship. Trump wants to get rid of it with an executive order, he told Axios on Tuesday, but it's widely understood by legal scholars to be enshrined in the 14th Amendment of the US Constitution.

Here's the first section of the 14th Amendment, which established the right to birthright citizenship (emphasis added):

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. No state shall make or enforce any law which shall abridge the privileges or immunities of citizens of the United States; nor shall any state deprive any person of life, liberty, or property, without due process of law; nor deny to any person within its jurisdiction the equal protection of the laws.

The Amendment was ratified in 1868, during the Reconstruction Era. It overruled Dred Scott v. Sandford (1857), one of the most disastrous cases in US history for African-Americans, which held that the descendants of slaves from Africa living in the US could not be US citizens.

Trump has brought up the idea of fighting birthright citizenship before. In an August 2015 interview with now-disgraced former Fox News host Bill O'Reilly, he said the 14th Amendment doesn't apply to "anchor babies," a pejorative term used to describe children whose parents entered the country illegally to have a child who would be born in the US and granted US citizenship. Trump reiterated his anti-immigrant message to Axios, saying he wants to target "anchor babies" and "chain migration" with the policy.

To get rid of birthright citizenship would mean that the United States would have to pass a new amendment, or the Supreme Court would have to interpret the 14th Amendment differently from the way it has in the past.

But in case after case, the Supreme Court has interpreted the 14th Amendment broadly, making the conditions for non-citizenship extremely narrow. Three cases in particular tell us how Trump might fare if he brought his own argument to court.

President Donald Trump speaking during an event to salute U.S. Immigration and Customs Enforcement (ICE) officers and U.S. Customs and Border Protection (CBP) agents in August. AP Photo/Andrew Harnik

Ark, a cook working in San Francisco, was born in California to non-citizen Chinese parents. He visited China in 1890 and was detained upon his return to the US under the Chinese Exclusion Act, one of the fiercest restrictions on free immigration in US history.

The Chinese Exclusion Act prohibited the immigration of Chinese laborers, and the US argued that Ark was Chinese, not a US citizen, because he had Chinese parents. Ark challenged the US in court, and the Supreme Court eventually ruled that "citizenship by birth is established by the mere fact of birth." Ark was officially a US citizen, and the case set a precedent for the citizenship of children born in the US to foreign national parents.

Laurence Terrazas, also a US-born parent of immigrants, held citizenship in both Mexico and the US. He enrolled at a Mexican university in 1970, and as part of his application, he renounced his US citizenship and swore "adherence, obedience, and submission to the law and authorities of the Mexican Republic."

The State Department considered this a clear-cut case of giving up US citizenship. But, according to an appeals court decision in the case, Terrazas produced other forms where he declared "[b]y taking this oath I did not consider that I was relinquishing my rights as an American citizen."

Ultimately, the Supreme Court didn't rule on whether Terrazas had, in fact, renounced his citizenship. However, the court did rule that US citizens must to intend to renounce their citizenship in order to lose it.

"In establishing loss of citizenship, the Government must prove an intent to surrender United States citizenship, not just the voluntary commission of an expatriating act such as swearing allegiance to a foreign nation," Justice Byron White wrote for the majority.

This case might present Trump's most challenging potential hurdle, finding that even non-citizen children still have rights.

Plyler v. Doe struck down a Texas law that withheld funding for schooling of children of immigrants living in the US unlawfully. The last clause of the first section of the 14th Amendment prohibits states from denying "to any person within its jurisdiction the equal protection of the laws."

Even if those children aren't citizens of the US, an undocumented immigrant is still "a 'person' in any ordinary sense of that term," Justice William J. Brennan ruled for the majority. Brennan further said that being undocumented does not establish "a sufficient rational basis for denying them benefits," meaning that the state can't use undocumented status as a reason for discrimination.

This post has been updated.