Elected officials and immigration advocates in New York and New Jersey are celebrating Tuesday's U.S. Supreme Court ruling striking down President Donald Trump’s executive order banning birthright citizenship.

New York State Attorney General Letitia James, who filed a lawsuit against Trump’s executive order and a brief against it in the Supreme Court, said in a statement that “birthright citizenship is a constitutional guarantee that has defined this nation for generations.”

“I am relieved for the children who will never know how close the American dream came to being taken from them,” James said, adding, “and for the families who will never have to explain to a child why the country they were born in refuses to accept them.”

New Jersey Attorney General Jennifer Davenport, who also filed a lawsuit against the order and a Supreme Court brief against it, said in a statement: “The president cannot change our citizenship laws with the stroke of a pen. We stood up for the rule of law, we stood up for our residents, and we won.”

The Supreme Court’s 6-3 ruling denied Trump what would have been a formidable tool in his bid to crackdown on both legal and illegal immigration, a defining policy objective of his second term in the White House.

The decision follows a key ruling from the court last week that allowed the Trump administration to move forward with plans to end humanitarian immigration protections allowing hundreds of thousands of Haitian and Syrian immigrants to continue to live and work in the country legally, likely setting the stage for the removal of like-situated immigrants from a dozen other counties.

The high court also allowed the Trump administration to further limit how the claims of immigrants seeking asylum are processed.

New York Gov. Kathy Hochul applauded the decision in a statement on social media, invoking her Irish immigrant grandparents.

"For generations, immigrants have come to New York in search of freedom and opportunity, helping build the strongest, most vibrant state in the nation,” Hochul said. “The Statue of Liberty stands proudly in our harbor, and New York will always stand with those seeking the promise of America."

New Jersey Gov. Mikie Sherrill also applauded the ruling, posting on social media, "Donald Trump’s malicious attempt to tear down this guarantee was so plainly unlawful and reckless that his own hand-picked Supreme Court said no. We are a nation of laws, and no president should have the power to change that with a stroke of a pen."

Tuesday’s ruling struck down an executive order issued on the first day of Trump’s second turn. It sought to ban the usual conferral of citizenship to anyone born in the country, a guarantee that extends back to the late 19th century with the ratification of the 14th Amendment in the wake of the Civil War.

Trump’s order, which argued the 14th Amendment had never been interpreted to extend citizenship universally to everyone born within the United States, would have ended birthright citizenship for the children of immigrants without legal status and those with temporary legal status, such as a visa.

Yaritza Mendez, deputy director of Make the Road New York, a local chapter of the national immigration advocacy group, joined by others in Foley Square, Manhattan, following Tuesday's Supreme Court ruling upholding birthright citizenship.

Yaritza Mendez, deputy director of Make the Road New York, a local chapter of a national immigration advocacy group, said in a statement on behalf of the organization’s 30,000 members: “This decision rejects the administration's attempts to redefine citizenship and is a victory for immigrant families across the United States. No child should have to wonder whether they belong in the country where they were born."

Last week, the Supreme Court allowed the Trump administration to move forward with a plan to end immigration protections for hundreds of thousands of Haitians and Syrians across the country, potentially paving the way for their deportation.

In that decision, the justices cleared the way for the Trump administration to end Temporary Protected Status, a kind of humanitarian protection against deportation extended to immigrants from nations deemed too dangerous for them to be returned to — because of war, disease, environmental disaster or some other “extraordinary and temporary” condition.

“Given last week's terrible TPS and asylum decisions, it is a relief that birthright citizenship remains intact,” Alina Das, co-director of the Immigrant Rights Clinic at NYU, said in a statement. “But it's also deeply disturbing that even this issue divided the justices.”

Many immigrant rights advocates and civil rights activists said they anxiously awaited the ruling on birthright citizenship, a major constitutional question looming since the start of Trump’s second term.

“ I realized that I had been holding my breath, and I finally breathed a literal sigh of relief,” said Carolina Gonzalez, a spokesperson for Latino Justice  PRLDEF, a civil rights organization based in Manhattan.

“ I am really glad to hear that we are not going to have hundreds of thousands of babies suddenly becoming stateless and being cut off, wrongfully cut off from access to any of the rights that come with citizenship,” Gonzalez said.

Mayor Zohran Mamdani said in a statement the status of birthright citizenship should never have been in doubt.

“New York City is living proof of the power of birthright citizenship," Mamdani said. "The children of immigrants are our teachers, nurses, construction workers, small business owners, artists, public servants and neighbors. They are New Yorkers, and they are Americans."

In a joint statement, New York City Council Speaker Julie Menin and Immigration Committee Chair Elsie Encarnación called birthright citizenship a “cornerstone of who we are as a country.”

“At a time of deep division, today’s ruling affirms that the Constitution cannot be rewritten by executive order,” they said, adding that the city budget deal reached on Tuesday includes a “historic” $81.8 million for immigration legal services.

Bethany Li, executive director of the Asian American Legal Defense and Education Fund, said the ruling stood for the principle that citizenship could not be "stripped away" by shifting politics or prejudice.

"The administration tried to build the hereditary underclass the amendment seeks to prevent," Li said. "Today, the court refused to allow this terror to continue, as every federal court before it had. For the families this order targeted, the fear ends today: their children keep their place in the only country they have ever called home."

Retired Cornell immigration law professor Stephen Yale-Loehr said in a statement that the ruling marks a “historic loss” for the Trump administration, but still “the Trump administration is winning its war on immigrants.”

Yale-Loehr pointed to the Trump administration’s more than 700 policy restrictions on immigration, including suspending visa processing for dozens of countries, halting refugee admissions except for white South Africans, and instituting mass detentions and deportations.

He added that as a result, the United States has net-negative migration for the first time in 50 years, fewer international tourists are visiting, and U.S. companies can’t hire needed workers.

“The Trump administration's cruelty toward immigrants will continue unabated,” Yale-Loehr said. “This ruling is the exception, not the rule.”

This story are updated with additional comment.