– In early November, word began to leak that Amazon was serious about choosing New York to build a giant new campus. The city was eager to lure the company and its thousands of high-paying tech jobs, offering billions in tax incentives.

Then Amazon made it official: It chose the Long Island City neighborhood of Queens to build a $2.5 billion campus that could house 25,000 ­workers. Gov. Andrew Cuomo and New York Mayor Bill de Blasio trumpeted the decision as a major coup after edging out more than 230 other plans.

But what they didn’t expect was the protests, the hostile public hearings and the disparaging tweets that would come in the next three months, eventually leading to Amazon’s dramatic Valentine’s Day breakup with New York.

Immediately after Amazon’s Nov. 12 announcement, criticism started to pour in. The deal included $1.5 billion in special tax breaks and grants for the company, but a closer look revealed it to be worth at least $2.8 billion. Some of the same politicians who had signed a letter to woo Amazon were now balking at the tax ­incentives.

“Offering massive corporate welfare from scarce public resources to one of the wealthiest corporations in the world at a time of great need in our state is just wrong,” said New York state Sen. Michael Gianaris and New York City Councilman Jimmy Van Bramer, both Democrats, who represent the Long Island City area.

The next day, CEO Jeff Bezos was on the cover of the New York Post in a cartoonlike illustration, hanging out of a helicopter, holding money bags in each hand, with cash billowing above the skyline. “QUEENS RANSOM,” the headline screamed. The New York Times editorial board, meanwhile, called the deal a “bad bargain” for the city.

Anti-Amazon rallies were planned for the next week. Protesters stormed an Amazon bookstore on the day after Thanksgiving and then went to a rally on the steps of a courthouse near the site of the new headquarters in the rain.

They had a long list of grievances: The deal was done secretively; rich Amazon didn’t need nearly $3 billion in tax incentives; rising rents could push people out of the neighborhood, and the company was opposed to unions.

The helipad kept coming up, too: Amazon had been promised it could build a spot to land a helicopter on or near the new offices. At the first public hearing in December, which turned into a hostile three-hour interrogation of two Amazon executives by city lawmakers, the helipad was mentioned more than a dozen times. The image of high-paid execs buzzing by a nearby low-income housing project became a symbol of corporate greed.

Eventually, Amazon’s own doubts started to show. On Feb. 8, the Washington Post reported that the company was having second thoughts about Queens. The final blow landed Thursday, when Amazon announced that it was backing out, surprising the mayor, who had spoken to an Amazon executive Monday night and received “no indication” that the company would bail.

“I was flabbergasted,” De Blasio said. “Why on Earth after all of the effort we all put in would you simply walk away?”