SEATTLE — Seattle's city council voted on Tuesday to repeal a newly enacted "head tax" imposed on the city's largest companies, including Amazon.com, in the face of apparently insurmountable big-business opposition to a tax meant to fight an affordable housing crisis.

The 7-2 vote in favor of repeal capped an acrimonious public hearing interrupted by chanting supporters of the tax. It came as momentum was building for a referendum drive against the measure, just weeks after it was unanimously adopted by the council and signed by the mayor.

"This is a cowardly betrayal of the needs of the working people," Councilwoman Kshama Sawant, a leading proponent of the tax who voted against repeal, said to thunderous applause moments before the council completed its vote.

But Councilwoman Lisa Herbold said she was reluctantly voting for repeal rather than drag the city through a political fight she called "not winnable at this particular time."

"The opposition has unlimited resources," she added.

Amazon.com, the city's largest employer, was at the forefront of a coalition of businesses running a well-financed campaign to place a repeal referendum on the ballot for the November elections.

The tax would have applied only to the city's largest companies by revenue, those grossing at least $20 million a year. It was expected to be borne by about 500 companies.

It is clear that the ordinance will lead to a prolonged, expensive political fight over the next five months that will do nothing to tackle our urgent housing and homelessness crisis. These challenges can only be addressed working together as a city, state and region. — Mayor Jenny Durkan (@MayorJenny) June 11, 2018

Opponents had already collected nearly 49,000 signatures from voters in support of a repeal initiative, well more than the 17,000 needed to qualify for the ballot, according to the Downtown Seattle Association, a business group which led the petition drive.

The effort quickly raised $300,000, including contributions of $25,000 each from Amazon and coffee retailer Starbucks , another major Seattle stalwart, and $30,000 from a grocers trade group, said Jon Scholes, president of the Seattle Association.

The measure, passed on May 14, would have levied a tax of roughly 14 cents per employee per hour worked within the city to raise at least $45 million over five years. The revenues were earmarked to build affordable housing and furnish support services for the homeless.

Sponsors of the tax said Seattle's biggest-earning businesses should bear some burden for easing a shortage of low-cost housing that they helped create in driving up real estate prices to the point where the working poor and many middle-class families can no longer afford to live in the city.

Opponents branded the measure a "tax on jobs" and said they feared it would spark an economic backlash.

Amazon had threatened to abandon plans for a major downtown office building if the head tax was approved.

The debate has been closely watched by politicians in major cities nationwide. Last month, about 40 elected officials from across the country, some from local governments vying to host Amazon's second headquarters, published an open letter to Seattle in support of the head tax and expressing concern that Amazon opposed the measure.