By Megan Henney, Fox Business–

AmazonOpens a New Window. said on Thursday it pulled out of its plan to build a second headquarters in New York City on Thursday following a flood of opposition from city and state officialsOpens a New Window..

The e-commerce giant was supposed to build its new campus in Long Island City, a neighborhood in Queens, but has faced mounting criticism for the $3 billion in incentives that it would receive as a result of the deal. In exchange, Amazon said it would create 25,000 high-paying jobs and invest tens of millions of dollars in the local area.

“We are disappointed to have reached this conclusion — we love New York, its incomparable dynamism, people, and culture — and particularly the community of Long Island City, where we have gotten to know so many optimistic, forward-leaning community leaders, small business owners, and residents,” the statement said.

“While polls show that 70 percent of New Yorkers support our plans and investment, a number of state and local politicians have made it clear that they oppose our presence and will not work with us to build the type of relationships that are required to go forward with the project we and many others envisioned in Long Island City,” the company added.

According to a poll released Tuesday by the Siena College Research Institute, 56 percent of voters around the state support the project, compared to 36 percent who said they don’t.

Amazon selected New York after a year-long competition that left hundreds of cities around the country scrambling to pitch themselves to the Seattle-based corporation. In November, Amazon said it would split its headquarters between Arlington, Virginia, and New York.

The decision was made, however, after closed-door meetings between Amazon officials and New York Gov. Andrew Cuomo and New York City Mayor Bill de Blasio. Since then, several New York City Council members and state politicians have criticized the deal, which they say is not only bad for local residents, but sets a bad precedent of corporations taking advantage of cities. They also begrudged Cuomo and de Blasio for the clandestine meetings, which they said eliminated any potential veto power by the City Council.

Those critics included Democratic New York State Sen. Michael Gianaris, who last week was nominated to the Public Authorities Control Board. If Cuomo approved his nomination, Gianaris could have had veto power over the deal.

“Like a petulant child, Amazon insists on getting its way or takes its ball and leaves,” Gianaris told the New York TimesOpens a New Window.. “The only thing that happened here is that a community that was going to be profoundly affected by their presence started asking questions.’’

Amazon had not yet to leased or purchased office space for the project, making it relatively easy for it to withdraw from its commitment. For now, Amazon said it will not reopen the HQ2 search.

Last week, Amazon hinted at the possibility of the collapse of the HQ2 deal. Unnamed sources told The Washington Post that Amazon was unsure whether it was worth it to expand in New York, given the frosty reception from some locals.

“The question is whether it’s worth it if the politicians in New York don’t want the project, especially with how people in Virginia and Nashville have been so welcoming,” said one person familiar with the company’s plans, according to the Post.