ALBANY — A series of tense, closed-door meetings during which Amazon was pressed to hire union workers at its proposed Queens headquarters preceded the company’s abrupt pullout on Thursday, which shocked even insiders, according to several people familiar with the discussions.

Two days before, in his 38th floor office in Manhattan on Tuesday morning, Gov. Andrew M. Cuomo met with four Amazon executives, Stuart Appelbaum, president of the Retail, Wholesale and Department Store Union, and Mario Cilento, president of the New York State AFL-CIO.

The prize was clear: A promised 25,000 jobs with an average salary of $150,000, but Cuomo and Mayor Bill de Blasio were urging Amazon to hire a union workforce.

The 8,000-word memorandum of understanding signed by Amazon and state and city leaders on Nov. 12 made no mention of unions or collective bargaining, and Amazon was, at the time, facing calls for strikes at its facilities in Germany and Spain.

That left perhaps the stickiest issue to be worked out, three months after New York was chosen for a headquarters in a nationwide competition for what would have been the state’s biggest economic development coup in history.

Ninety minutes later, with handshakes all around, what may have been the last and stickiest issue in the megaproject appeared to finally be on track. They agreed to a “framework” on union hiring, a potentially major concession for the traditionally anti-union Amazon.

The union leaders, used to seeing union wages required for economic development projects, admitted the agreement wasn’t much. It allowed only for a fair vote by workers on whether to unionize, and provisions against retaliation against union supporters.

Get the Breaking News newsletter! Get the latest breaking news as it happens. By clicking Sign up, you agree to our privacy policy.

“It was weak stuff,” Appelbaum said in an interview. “It wasn’t neutrality” in a union vote. “It was very, very basic and less than we would have wanted. But it was the first time anywhere we knew of that Amazon was willing to sit down and talk about a path to unionization.”

Then came the phone call.

Cuomo, who once joked that he’d change his first name to Amazon if it would seal the deal, was told Wednesday night that the deal was off. He was "beyond furious," one source said.

The next morning, the news became public.

In a 360-word statement, Amazon said, “The commitment to build a new headquarters requires positive, collaborative relationships with state and local elected officials who will be supportive over the long-term. 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 news rocked Albany, even those close to the project.

“Our lawyers were working on language,” Appelbaum recalled. “Then someone at the very top, I presume (CEO Jeff) Bezos, said, ‘We don’t talk to people, we tell them.’

“They created a process that was doomed to fail,” Appelbaum said. “It revealed they didn’t want to listen.”

Some have suggested that Amazon also may have been concerned about being a long-term political target for those opposed to the deal.

“They have an agenda in Washington,” said Kathryn Wylde, CEO of the Partnership for New York City. “When you have high-profile members of Congress (Sen. Elizabeth Warren, Rep. Alexandria Ocasio-Cortez) jumping on the Amazon New York location controversy, that’s not tenable for them. They have big stakes down there with the privacy issues . . . They don’t need to become a target of the liberal wing of the national Democratic Party.”

Cuomo, meanwhile, has blamed State Senate Deputy Majority Leader Michael Gianaris of Queens for his public criticism of the Amazon deal, pushed by liberal and democratic socialist opponents of what they saw as corporate welfare.

In recent weeks, Gianaris had described the Amazon deal struck by Cuomo without legislative input or approval “a horrible deal for the people of Queens and the people of New York” and accused Amazon of “extortion” to land $3 billion in tax breaks and incentives.

Freshman U.S. Rep. Alexandria Ocasio-Cortez, the champion of a rising democratic socialist movement, tweeted at the time: “Why should corporations that contribute nothing to the pot be in a position to take billions from the public?”

But de Blasio said no one should cheer Amazon's departure.

"I think it is a real oversimplification to suggest every working person out there just is feeling great that we’ve lost all these jobs and lost all this revenue," de Blasio said on WNYC "Brian Lehrer Show" on Friday. "In fact, the polls would suggest the opposite. The polls were quite clear. According to income level, low-income folks wanted this deal to work. Higher-income folks, more educated folks who had already made it, were the ones who had opposition."

With Matthew Chayes and James T. Madore