By a razor-thin margin, Philadelphia City Council on Thursday voted to implement a new tax on construction projects, a controversial measure designed to raise money for affordable housing but one that has divided some of the area's most influential forces.

Lawmakers said the tax, which passed, 9-8, will generate about $22 million annually.

On one side of the legislation was Philadelphia's politically powerful building trades unions, who argued that it would slow the city's construction boom. On the other, Council President Darrell L. Clarke and activists said the city has to be a more affordable place to live.

Even after the proposal's passage, it's unclear whether it will become law: Council sources said Mayor Kenney is likely to veto the bill.

Kenney said he will decide what to do over the summer and consider alternative proposals. It takes 12 votes to override a mayoral veto.

"I'm committed to increasing Philadelphia's affordable housing stock and to promoting equitable growth, but I have concerns about this particular piece of legislation," Kenney said. "Philadelphia is already considered by many to have a pretty onerous tax system, and it is certainly not clear that adding another tax is the best way to address our housing crisis."

The 1 percent tax on construction would help finance the city's Housing Trust Fund, whose revenues could be used by developers to build housing for those households earning up to $105,000 a year.

Both sides were lobbying Council members to the last possible minute. Councilwoman Maria Quiñones-Sánchez, a major proponent of the legislation, said "there was a lot of elbowing" in the hours before the vote and "I'm glad people stayed firm."

>> READ MORE: City Council to decide if construction impact tax is creative financing or just another Philly tax | Editorial

A coalition of community groups and faith-based organizations asked Council members to vote for the tax this week, despite previously expressing concerns that it was not exclusively targeted toward the city's most impoverished residents. On Monday, the activists said in a letter that the Housing Trust Fund is a "tool that works but is drastically underfunded."

Less than 24 hours before Council voted on the construction tax, Kenney's team shared an analysis with lawmakers projecting that the levy would result in the loss of more tax dollars than it would generate.

In addition to costing the city millions to implement, the Kenney administration said, it would also result in lost real estate-transfer- and wage-tax revenues as the tax discouraged some projects.

Clarke pooh-poohed the mayor's study as "a last-ditch attempt to stop an affordable housing plan that is much needed" in Philadelphia. Kenney's spokesman said the analysis was requested by Council members.

"The timing of it is obviously quite interesting," Clarke said of the study. "I promised that I was not going to call it absurd, but the simple reality is the numbers just don't match."

The construction tax faced fierce opposition from the building trades unions. John Dougherty, a Kenney ally and leader of the trades, said it was "ill-conceived" and "would have the net effect of ending the recent prosperous run of new construction that is transforming neglected sections of the city."

In addition to Clarke and Sánchez, Council members Mark Squilla, Bill Greenlee, Kenyatta Johnson, Curtis Jones Jr., Cherelle Parker, Blondell Reynolds Brown, and Helen Gym voted for the tax. The lawmakers who voted against it were Cindy Bass, Jannie Blackwell, Allan Domb, Derek Green, Bobby Henon, Brian O'Neill, David Oh, and Al Taubenberger.

Oh said he was concerned that it would hurt poor and middle-class residents who make improvements to their homes. He also questioned whether the city, which has been criticized as doing a poor job collecting real estate taxes, would be able to collect the new levy.

Henon, a former political director for the city's electricians union, called the construction tax "fiscally irresponsible" and a "tax on the [10-year] tax abatement." He said he expected lawmakers would "adjust" the abatement on new construction, and "hopefully it will be in support of a comprehensive affordable housing plan."

Sánchez, meanwhile, said, "When we are rolling out the red carpet for Amazon, we need to show long-term residents, the working-class community … that we are just as intentional to help them in being able to stay in their homes and expand home-ownership opportunities."

She added, laughing, "How much money was made today by all of the consultants?" a reference to those lobbying against the tax. "I should make them buy me lunch."

If Kenney vetoes the tax, it will be the first veto of his career.