In a startling turnabout for the world’s most valuable public company, e-commerce giant Amazon announced Thursday it is canceling plans to build a sprawling headquarters complex in New York City.

The company said its decision was prompted by local opposition to the plan, along with fierce criticism from lawmakers who denounced the $3 billion in state and local subsidies that convinced Amazon to situate half of what it called its “HQ2” in Long Island City, Queens.

Amazon said the deal would have created more than 25,000 jobs.

The New York Times called Amazon’s decision “a major blow for Gov. Andrew M. Cuomo and Mayor Bill de Blasio, who had set aside their differences to lure the giant tech company to New York.”

Amazon’s announcement said it does “not intend to reopen the HQ2 search at this time,” adding in a blog post that “We will proceed as planned in Northern Virginia and Nashville, and we will continue to hire and grow across our 17 corpoorate offices and tech hubs in the U.S. and Canada.”

Opponents to Amazon’s plan “included labor unions, community groups and left-leaning elected officials,” reported the Washington Post, which is owned by Amazon CEO Jeffrey Bezos.

Among the strongest opposition leaders was state Sen. Michael Gianaris, whose neighborhood includes Long Island City, and who is on a board with the power to veto the deal. He said residents “would be profoundly affected” by the development, including likely sharp rises in housing costs, but that Amazon was unwilling to work with the community.

“Like a petulant child, Amazon insists on getting its way or takes its ball and leaves,” Gianaris told the Times.