The deal for the city to sell the local Boy Scouts headquarters to the scouting group has fallen through, leaving it unclear how Philadelphia will pay an estimated $963,575 in legal fees and, at least for now, handing a temporary victory to those who had opposed the plan.

In a filing in federal court Friday, the Boy Scouts' attorney, Jason Gosselin, said: "The parties concluded that the settlement agreement would never be approved by City Council."

City Council legislation was required to sell the city-owned building to the Boy Scouts Philadelphia group, the Cradle of Liberty Council.

Legislation that Councilman Darrell L. Clarke introduced on behalf of Mayor Nutter to allow the sale went nowhere last year, after gay-rights advocates complained about the national Boy Scouts policy of not allowing membership by homosexuals.

The city owns the Boy Scouts building in the Logan Square neighborhood and tried to evict the organization over its national policy of excluding gays. That led to a federal lawsuit, which the city lost, forcing it to pick up the Boy Scouts' bills.

City officials could not immediately say what they would do next. Options include appealing the case, which gay-rights advocates have long demanded.

In the meantime, the legal bills are mounting. Also in the Friday filing, Gosselin said that since the attorneys' fees were initially awarded in July 2010, his firm, Drinker, Biddle & Reath L.L.P., had since done more work, bringing the total to about $1.04 million.

"We would be happy to have the old deal, but we can't do it without the city," Gosselin said, "so we're at an impasse."

The amount of the bills has been in dispute; Gosselin also filed exhibits detailing the work to explain the total.

The city had agreed to sell the 13,000-square-foot building to the Scouts for about $500,000 as payment for the legal fees, about half the property's appraised value. Advocates for the gay community called it a sweetheart deal. The city has defended the decision as a reasonable compromise to avoid paying the higher amount of the legal bills.

Duane Perry, a former Eagle Scout and one of many civil-liberties advocates who had opposed the settlement, said he believed the city should continue to press the Boy Scouts to stop discriminating.

Clarke did not return a phone call seeking comment.

"This matter is in litigation," said Mark McDonald, a spokesman for the mayor, "and I am unable to comment."

Real estate investor Mel Heifetz has offered to pay as much as $2 million for the building, but the city has previously said it could not consider a competing offer while the old one was on the table.