The City of Philadelphia and a local Boy Scouts chapter have settled their legal dispute over gay rights, the AP reported.

A federal jury in June ruled that the city could not evict the Philadelphia chapter of the Boy Scouts, known as the Cradle of Liberty Council, from a city-owned building for refusing to admit gay members.

The city decided to terminate the scout's nearly-free lease in 2007, insisting that nonprofits must abide by local anti-discrimination laws, including an ordinance that protects based on sexual orientation.

Under the settlement announced Wednesday, the city will sell its stately Beaux Arts building for less than half of its $1.1 million value to the group. In exchange, the Scouts have agreed to forgive the nearly $1 million legal tab the court ordered the city to pay.

“At the end of the day, the Boy Scouts will be writing a check to the city, rather than the other way around,” Jason Gosselin, an attorney for the Scouts, told the news service. “This is a better solution than having to go through an appeals process.”

In 2000, the Supreme Court agreed that the Texas-based Boy Scouts of America, as a private group, can set up their own rules.

The Cradle of Liberty Council faced eviction after it refused to specifically repudiate the gay ban.