ALBANY – Amazon's plans for New York City were poised to become one of the largest economic-development projects in state history.

Between 25,000 to 40,000 jobs in the Long Island City section of Queens. An estimated $27 billion in tax revenue, backed by $3 billion in state and local subsidies.

Supporters said it would advance the city's efforts to bolster its tech sector, making it less reliant on the fluctuations from Wall Street.

But soon after New York won a national competition last November along with Virginia for the Amazon HQ2, the project started to unravel.

And on Thursday, Amazon pulled out of the deal, leaving supporters to point fingers at who is to blame and opponents celebrating their ability to beat back the world's largest company.

"Anything is possible: today was the day a group of dedicated, everyday New Yorkers & their neighbors defeated Amazon’s corporate greed, its worker exploitation, and the power of the richest man in the world," Rep. Alexandria Ocasio-Cortez, who represents a neighboring district, wrote on Twitter.

Here's how the deal unraveled:

The big deal

New York City outlasted 238 bids across North America for Amazon HQ2, with the Seattle-based company touting the city's workforce and infrastructure.

The state and city offered nearly $3 billion in public subsidies over 15 years, but the money was largely tied to bringing as many as 40,000 jobs to the city, with a minimum of 25,000 jobs.

Already apartment and home prices started to go up in Long Island City, and local leaders were urging Amazon to invest more into the neighborhood as part of its development.

More:Amazon drops plans to add headquarters in New York City amid local opposition

More:What Amazon's decision means for New York's bottom line

The opposition

While Gov. Andrew Cuomo and New York City Mayor Bill de Blasio brokered the deal, they and their supporters were upended by opponents in Queens.

Amazon refused to discuss any unionization of its workforce, which the company pledged would have salaries on average of $150,000 a year.

That doesn't work in the city, which has one of the largest unionized workforces in the nation.

That, along with the subsidies for the company owned by the richest man in the world, Jeff Bezos, drove some of the powerful unions to galvanize against the project. Then add in liberal Democrats like Ocasio-Cortez, New York City Council Speaker Corey Johnson and Sen. Mike Gianaris, who represents the area.

“Today New York’s working class showed that big business and billionaires can’t buy our city. New York belongs to the many, not the few," said the New York City chapter of the Democratic Socialists of America.

More:Andrew 'Amazon' Cuomo meets his match, and all New York pays

More:Amazon HQ2 timeline: The winners are New York City and Arlington, Virginia

Meetings were positive

Amazon's decision came after a series of productive meetings with company executives in recent days, union and government officials said.

On Wednesday, Amazon executives met with Cuomo in his office with union leaders to discuss ways to address workers' rights and efforts to avoid any hostility toward workers who would look to unionize.

The sides left with handshakes and plans to draft language to address each others' concerns, said Stuart Appelbaum, president of the Retail, Wholesale and Department Store Union, who attended the meeting.

"We listened to each other, expressed our concerns and had a framework going forward," he said.

That was followed up with a Thursday meeting with Amazon and aides to Cuomo and de Blasio on working on concerns of the community.

So union leaders and government leaders were shocked when Amazon's decision came just hours later around noon Thursday.

"At a meeting Wednesday with Amazon officials, progress was being made to address outstanding issues," said Mario Cilento, president of the AFL-CIO, who attended Wednesday's meeting.

"Unfortunately and surprisingly, Amazon abruptly turned their backs. An opportunity for thousands of jobs was lost."

Who is to blame

Take your pick.

Opponents blamed Amazon for not listening more closely to the concerns of residents, who were worried about increased traffic, higher home costs and gentrification of the neighborhood.

"Rather than seriously engage with the community they proposed to profoundly change, Amazon continued its effort to shakedown governments to get its way," Gianaris said.

De Blasio was angered at Amazon, not local opponents for scuttling the deal.

"Sure, there was some voices that raised critiques, but that's part of democracy," he said. "I really think in the end this was Amazon's choice that it was a huge mistake."

Cuomo, though, put the blame on his fellow Democrats, particularly those in the state Senate, saying they "should be held accountable for this lost economic opportunity."

Senate Democrats appointed Gianaris to a key state board, the Public Authorities Control Board, that would have to approve some of the funding for the deal.

Doing so appeared to be the final straw, at least in Amazon's eyes, which also said some local leaders refused to even meet with company leaders.

Jodi Seth, an Amazon spokeswoman, told NBC News, that votes by the Public Authorities Control Board weren't scheduled for the project for at least a year, leaving uncertainty over whether the project would face setbacks.

"We wouldn't have even known if the deal would be approved until a year from now," she said.

"We were pretty confident the deal would be approved, in that the governor was working hard to make it happen, but looking at the opposition and the timeline we decided we don't want to work in this environment in the long term."

Now what?

With Amazon pulling out of New York City, many of the other areas who were rejected by the company for its headquarters are pleading with them to give their areas a second look.

Newark, New Jersey, has done so, as well as the various regions of upstate New York.

"While some in New York City can say no to tens of thousands of jobs, I would question the sanity of anyone in Rochester or upstate who would do the same," said Robert Duffy, Cuomo's former lieutenant governor and now head of the Greater Rochester Chamber of Commerce.

But don't expect Amazon to engage in another bidding war.

It said it won't look for another headquarters and instead will simply stick with Virginia and Nashville, Tennessee, while hiring at its corporate offices across the country.

As for the politics in New York, expect the infighting to continue.

Even though Democrats control of all state government, there are now serious riffs over the failed deal that will certainly bear out as lawmakers and Cuomo look to negotiate a state budget for the fiscal year that starts April 1.

Cuomo didn't hide his anger.

"A small group of politicians put their own narrow political interests above their community," Cuomo said Thursday in a statement.

More:Could Amazon still pick another HQ2 site after ditching New York?

More:Amazon's pullout 'devastating' to Lower Hudson Valley