Photo: Forest City / Forest City

Hearst, owner of The San Francisco Chronicle, has agreed to sell off portions of its 5M development site, a 4-acre, mixed-use project at Fifth and Mission streets.

The buyer is Forest City Realty Trust, which has been partnering with Hearst on the development for nine years.

Under the agreement, Hearst will sell Forest City a site that has been approved for a 617,900-square-foot office tower at Fifth and Howard streets, as well as land slated for a 288-unit apartment building on Mission Street. Escrow for the Mission Street apartment site will close later this year. Escrow for the Howard Street office site is expected to close in 2018. Terms of the sale were not disclosed.

Hearst will hold on to The Chronicle building at 901 Mission St., which will continue to serve as the home for the newspaper, which has been located there since 1924. Hearst will also keep a Fifth Street site, just to the south of The Chronicle building, that is set to be redeveloped with a 400-unit condominium building.

The deal is the latest chapter in a redevelopment process that started in 2007 when Hearst hired the real estate consulting company CBRE to explore development of a collection of lots that span 4 acres between Howard and Mission streets in the city’s burgeoning South of Market neighborhood. In March 2008, Hearst selected Forest City, which was a partner in the development of the nearby Metreon and the expansion of the Westfield San Francisco Centre.

The project Hearst and Forest City came up with, dubbed 5M, is a sweeping reimagining of a transition block between SoMa and downtown San Francisco, a mix of housing, office space and arts. The project includes an acre of open space and 241 units of affordable housing, including an 83-unit, $24.5 million affordable senior housing complex at 967 Mission St.

The plan was opposed by nearby condo owners, who objected to the height of some of the buildings, as well as some neighborhood nonprofit organizations that argued that the $1 billion investment would squeeze out what remains of a working-class enclave of residential hotels and subsidized housing buildings that has long been a center of the Bay Area’s Filipino community.

The development won approvals at the city Planning Commission and the Board of Supervisors in November 2015. Since then it has been tied up in court. A group of neighborhood opponents sued to block the development, a lawsuit that was tossed out in January and then appealed to the Court of Appeal. There is no date set on when the court will rule on the case.

In addition to two new residential buildings, a new office building and new public open spaces, the privately funded development also calls for the retention or renovation of three historic buildings, including The Chronicle’s home, as well as the donation of the Dempster Printing Building to nonprofit arts uses.

“This transaction allows Hearst and Forest City to move forward separately with the development of the properties best suited for each party, while we continue to work together on the 5M master plan as approved by the city,” said Marty Cepkauskas, director of real estate for Hearst’s Western Properties division.

Kevin Ratner, president of Forest City West, said his company is “excited to acquire the land for these future residential and commercial assets.”

“We’re firmly committed to moving forward with the project so that the significant benefits created with the community and the city can be realized,” Ratner said.

J.K. Dineen is a San Francisco Chronicle staff writer. Email: jdineen@sfchronicle.com Twitter: @sfjkdineen