Starrett City, the nation’s largest federally subsidized housing complex, was sold in a $1.3 billion deal that is already drawing fire because of the buyer’s history of housing violations.

Berkshire LLC, a closely held Brooklyn real estate company run by David Bisticer, beat out six other bidders who offered between $600 million and $1.3 billion for the development, a 140-acre, 46-building complex that is home to around 14,000 people.

While there is an initial agreement for the purchase of the nearly 5,881 apartments, governmental hurdles must be cleared before a deal closes.

Starrett City Associates is led by financier Disque D. Deane, and the investment group that owns the property includes the Trump family.

Donald J. Trump said he was “thrilled,” with the purchase price. “I’ve been with it a long time and I’m thrilled with the outcome,” he said, noting it was one of his first investments.

The sale of the multi-building sprawling development, variously known as Starrett City and Spring Creek Towers, has been in the works through marketers CB Richard Ellis since last fall.

Only a handful of suitors were expected to bid on the property because many of the tenants have subsidized housing through the federal government and rules for transferring the property.

The deal has raised some concerns among community activists and city officials, who want to be sure the complex maintains affordable housing.