BOSTON (AP) — Massachusetts officials moved quickly to seize a potentially lucrative opportunity after Amazon announced its plans to build a second North American headquarters, but declined to choose a favored location and strategized about overcoming obstacles such as the region's high housing costs.

The prize is a $5 billion investment and 50,000 jobs promised by Amazon.

The Associated Press reviewed thousands of pages of emails and documents related to the state's formal Amazon bid obtained through a public records request and spoke to agencies involved in the bid.

___

QUICK OUT OF THE GATE

The news that broke early on Sept. 7 that Amazon was seeking a second North American headquarters created an immediate buzz at the highest state levels of state government.

Before 8 a.m., Secretary of Housing and Economic Affairs Jay Ash emailed Republican Gov. Charlie Baker's chief of staff and another top cabinet secretary informing them of the announcement and suggesting they meet to discuss. Minutes later, Baker's deputy chief of staff fired off an email to top officials asking "if there was interest in putting together a team similar to GE effort."

That reference was to a successful push by state and Boston officials in 2016 to convince General Electric to move its world headquarters from Connecticut to the city's Seaport District with $145 million in property tax and other incentives.

Along with internal conversations came a flurry of emails from developers, consultants and local officials eager to climb on the bandwagon. One of the first came from Thomas O'Brien, managing director of The HYM Investment Group, the owner of Suffolk Downs. O'Brien wrote Baker and Ash suggesting the former horse track was "perhaps the only Massachusetts site," that could fit all of Amazon's criteria.

___

NO ONE SITE

Suffolk Downs in East Boston emerged as the preferred site in the city of Boston's proposal to Amazon. But the internal documents reveal how the state settled on its strategy to promote Massachusetts in general, abstaining from picking a favored location and "pitching the whole state," as one official wrote in an email.

To make the pitch, data was collected to showcase Massachusetts' highly educated workforce and technology-driven economy. Officials also weighed the inclusion of other facts ranging from the state's commitment to reducing greenhouse gas emissions, renowned cultural and historical sites, and even the 10 championships won by its pro sports franchises since 2000.

Mayors and town managers were encouraged to submit their own bids if they met the company's stated preferences, which included proximity to a large metropolitan area and international airport.

The state's Amazon proposal would ultimately include 26 potential sites stretching from Boston to the Berkshires.

___

HOUSING HEADACHES

The shortage of and high cost of housing in Greater Boston was the "Achilles heel" of Massachusetts' efforts to lure Amazon, concluded a report circulated by state officials in late September.

"There is a high probability that adding 50,000 new jobs for one employer over the next 15 years will dramatically exacerbate the situation, making the current housing and transportation challenges even greater," the report warned.

The report appeared to arrive unsolicited under the heading of "How to win the bid for the new Amazon Headquarters." Its authors included Ted Carman, president of a local company that consults with municipalities on housing and zoning policies, and Barry Bluestone, a Northeastern University economist with an expertise in housing.

The authors suggested the state commit enough funding to a recently-created Workforce Housing Trust Fund to create 50,000 new units of housing — or one for each new job that Amazon would bring.

____

HERE, RUFUS

The state's pursuit of Amazon HQ2 was code-named Project Rufus by state officials.

Rufus was a much-beloved canine who achieved celebrity status of sorts during the early days of Amazon, accompanying his owners — the company's editor-in-chief and principal engineer — to work nearly every day.

Before his death in 1999, Rufus wiled away his days strolling hallways, sitting in on meetings and chasing tennis balls, according to his official biography on Amazon.com.

___

PUBLIC RESOURCES

The state paid nearly $177,000 to a consultant, Vanesse Hangen Brustlin Inc., to help shape Massachusetts' pitch, according to MassDevelopment, the state's semi-independent economic finance agency.

It's not clear if other state money was spent on the bid.