A 21-unit apartment building in Jersey City’s Heights neighborhood has sold for $4.1 million, ending more than three decades of family ownership.

The walk-up building at 3405 John F. Kennedy Blvd. was purchased by a local private investor, according to a statement from Marcus & Millichap, which brokered the transaction.

The Heights neighborhood is located atop the Palisades, along the west side of the Hudson River.

The property includes 17 one-bedroom units and four two-bedroom units, each with one bathroom.

Jonathan Zamora, senior director of investments in Marcus & Millichap’s New Jersey office, said the sale came after previous attempts to market the building had failed.

The building attracted buyers despite difficult market conditions, according to Zamora.

He cited the property’s vacant units, potential for higher rents, and opportunity for long-term improvements as selling points.

Zamora marketed the property for the seller and represented the buyer in the transaction. The buyer’s name was not disclosed.