“I have one message for President Trump: We will see you in court,” Bonta told reporters Tuesday. “If allowed to stand, this order would endanger thousands of U.S. citizens who will be born in the next year.”

Trump’s executive order would mean that birthright citizenship is not extended to children born in the U.S. to parents living in the country illegally, tourists or other temporary residents beginning on Feb. 19. It would not revoke the citizenship of children already born, or born before then.

Specifically, Trump’s order excludes those whose mothers were not legally in the United States and whose fathers were not U.S. citizens or lawful permanent residents, and people whose mothers were in the country legally but on a temporary basis and whose fathers were not citizens or legal permanent residents.

California, New Jersey and Massachusetts — states all controlled by Democrats — are leading the lawsuit, joined by Colorado, Connecticut, Delaware, Hawaii, Maine, Maryland, Michigan, Minnesota, Nevada, New Mexico, New York, North Carolina, Rhode Island, Vermont and Wisconsin to stop the order. The lawsuit asks a district court in Massachusetts to immediately stop the order from going into effect on Feb. 19. With the other states, Washington, D.C., and San Francisco have also signed on.

Arizona, Illinois, Oregon and Washington filed a separate suit in federal court challenging Trump’s order as well.

Bonta said the order would deny the future citizenship of 20,000 children born in California each year.

The lawsuit announced by Bonta on Tuesday is one of several legal challenges to Trump’s groundbreaking order, including one by the American Civil Liberties Union on behalf of immigrants whose children will be denied citizenship if the order survives legal scrutiny.

In the executive order, the Trump administration said the 14th Amendment “rightfully repudiated” the nation’s “shameful” history of denying citizenship to people of African descent.

“But the Fourteenth Amendment has never been interpreted to extend citizenship universally to everyone born within the United States,” the statement said.

Bonta contends that Trump’s order stands on shaky legal ground. He said the U.S. Supreme Court already has affirmed birthright citizenship twice in the nation’s history. That includes an 1898 decision protecting the citizenship of San Francisco-born Chinese American Wong Kim Ark that the nonprofit National Constitution Center said settled a disagreement among the justices about the meaning of the 14th Amendment’s “subject to the jurisdiction thereof” clause.

Born in San Francisco to a Chinese couple, Ark was refused reentry to the U.S. over questions about his citizenship after traveling to China as an adult to visit his parents. The court ruled 6-2 that because his parents weren’t “employed in any diplomatic or official capacity under the emperor of China,” he was automatically a U.S. citizen under the 14th Amendment.

“That case has been the law of the land for 127 years,” San Francisco City Attorney David Chiu told reporters. He called Trump’s order “a ruthless attack on newborns and future generations.”

The Associated Press contributed to this report.