After months of negotiations, the Mission Economic Development Agency (MEDA) has secured a long-term replacement for the One $ Store on 17th and Mission — and a new precedent.

Goodwill will move into the 3,000-square-foot ground floor of the proposed six-story, 27-unit apartment complex that building owner Timothy Muller has been hoping to build for the last nine years.

Muller has agreed to offer Goodwill a 15-year lease with two five-year options, giving the thrift store the opportunity to remain in the spot with a reduced rent of $3 per square foot for the next 25 years.

But, in a first-of-its-kind agreement signed Thursday afternoon, Muller also agreed to keep a low-priced retailer, selected by MEDA, in the space for the next 50 years.

“This is a new precedent of 50 years of community access,” said Peter Papadopoulos, a land use policy analyst with MEDA.

Papadopoulos said that, starting some six months ago, his organization began asking for 50-year commitments from developers.

“We said we were going to look at the long-term viability of our community and so we are looking for time frames that last decades. We know that without things being contractually held in place, it’s harder to stabilize our community.”

MEDA’s deal with Muller is the first time the organization achieved this new goal, according to Papadopoulos.

Muller was not available for comment. In June, Muller told Mission Local he was resistant to making a 50-year agreement. “Why subject a piece of property to a very long-term lease when you don’t know the future?”

During negotiations, MEDA also won an extra affordable unit. By law, Muller has to include three affordable units made available to people who earn 55 percent of the area median income. Now Muller will add one more affordable unit, made available to people who earn 80 percent of AMI.

Muller also agreed to contract Precita Eyes to paint a wraparound mural on the new building.

The negotiations were prompted after MEDA had filed for a discretionary review before the planning commission, claiming that the dollar store is a cultural asset that caters to low-income residents and helps alleviate the pressures of gentrification. MEDA wanted to make sure the store’s replacement continued to serve low-income residents in the Mission.

“The developer heard the concerns and worked constructively to reach an outcome that everyone would agree to,” said Papadopoulos.