The company that owns the Oakland home where protesting mothers were evicted last week said Monday it will sell the residence to a nonprofit affordable housing group — a decision it reached after speaking with Gov. Gavin Newsom and city leaders.

Under a “good faith” agreement announced Monday, Wedgewood Properties, which specializes in house-flipping, will negotiate the sale with the Oakland Community Land Trust, a nonprofit organization that acquires land and property for affordable housing, said the office of Mayor Libby Schaaf.

Schaaf helped arrange the deal that requires the three-bedroom, one-bath house at 2928 Magnolia St. to sell for no more than its appraised value. Although a formal appraisal will need to take place, the home is listed at $631,201 on the real-estate site Zillow.

Built in 1908, the two-story house sold in 1997 for $50,000, and in 1987 for only $15,000. Wedgewood bought the house for $500,000 at a foreclosure sale in July.

Under the agreement, Wedgewood will also negotiate a right-of-first-refusal program for its Oakland properties, about 50, according to the company. Wedgewood said it will also hire construction workers for its projects from local organizations, including the city’s Cypress Mandela, a job-training nonprofit.

“This is what happens when we organize, when people come together to build the beloved community,” Dominique Walker, one of the homeless mothers, said in a statement.

At a news conference Monday, Schaaf said: “These are huge wins in our fight to address the humanitarian crisis of homelessness.”

In November, a rotating group of at least three mothers calling themselves Moms 4 Housing moved into the vacant West Oakland home with their children. The families lived there for nearly two months before sheriff’s deputies evicted them last week, an act the mayor condemned. The group had repeatedly called on Wedgewood to negotiate with the Oakland Community Land Trust so the mothers could purchase the property through the nonprofit.

But the company said it would not negotiate as long as the women occupied its property. Wedgewood, a Southern California firm, is one of Oakland’s most prolific house flippers, rehabbing and selling 160 homes in nine years.

“Wedgewood wouldn’t negotiate or have any discussions until the squatters were out of the house,” said Sam Singer, a Wedgewood spokesman. “The company always said once the illegal activity was concluded, it would be open to having discussions.”

On Monday, Wedgewood said it decided to sell after speaking with Newsom, Schaaf and Councilman Larry Reid.

None revealed details about the discussion, and Singer insisted that Wedgewood got nothing in return for making the deal.

At a news conference Monday, Misty Cross, one of the mothers, said the company and the mayor’s office should have come to the negotiating table sooner.

“It shouldn’t have gotten this far for them to negotiate,” she said. “We are still hurting. There is still pain here. We went to jail. We stood up and put our bodies on the line. ... It should not have happened.”

In addition to selling the disputed home to the Oakland Community Land Trust, the company said Monday in a joint statement with Moms 4 Housing and Schaaf that it would provide a right of first refusal to the Trust and the city for all of its Oakland properties.

To do that, Schaaf said the city would implement a policy requiring Wedgewood to first offer its Oakland homes to the Trust to buy and convert into affordable housing. Schaaf said the organization will have a timeline, still to be determined, to work out a deal. If no deal is reached, Wedgewood could flip the house.

Wedgewood has also agreed to encourage other real estate companies that own properties in the city to follow in its commitment, Schaaf added.

The agreement “is a step in the right direction in helping to address Oakland’s homelessness and housing crisis,” Singer said in a statement. “We are honored and inspired to collaborate with the City of Oakland on reasonable, thoughtful, and organized actions to address the issue of homelessness and housing.”

Meanwhile, he said Wedgewood doesn’t believe the Trust will be able to buy all of the company’s properties.

“They will be able to buy some, whatever they budget for,” Singer said. “It’s a good community deed and it helps solve the problem that Oakland has. You never know where new relationships lead.”

Several weeks ago, the mothers confronted Schaaf during a housing rally outside City Hall and asked why she had not responded to their pleas for help.

Schaaf said she reached out to Gary Geiser, Wedgewood’s CEO, on Thursday — two days after the eviction — to discuss an agreement giving the mothers the first right of refusal to buy the home.

The mothers also requested a meeting with the governor, which prompted the conversation that led to the agreement, Schaaf said.

After the mothers moved into the house, a legal dispute ensued between them and the owners. Last week, a judge ordered the mothers removed. On Jan. 14, sheriff’s deputies in riot gear and using armored vehicles evicted the mothers in a predawn operation and arrested several of the mothers.

The mothers and their supporters have argued that housing is a human right and Oakland’s dire housing shortage gave them no choice but to take up residence in the home.

The case has highlighted growing tensions around Oakland’s housing and homelessness crisis. The city had a 47% increase in homelessness in just two years, and 3,210 homeless people are unsheltered, according to a point-in-time count.

“I’m so pleased to hear that what we and many others urged is now making progress,” said City Council President Rebecca Kaplan, who was among several council members who have called on Wedgewood to negotiate with the land trust. “It is vital to protect and provide affordable housing in our community.”

Schaaf said she is also convening an Advisory Board on Community Ownership of Housing, to be co-chaired by one of the mothers, to work on policies that will ensure speculative purchases are first offered to affordable housing organizations and that tenants have the right of first refusal on purchasing properties.

Sarah Ravani is a San Francisco Chronicle staff writer. Email: sravani@sfchronicle.com Twitter: @SarRavani