NEW YORK - The U.S. government has agreed to distribute proceeds from the sale of a Manhattan skyscraper linked to Iran to families who were affected by attacks aided by the Islamic republic, according to a court document filed Thursday.

The settlement between the Department of Justice and the families marks the latest step in a long-running case over ties between the Manhattan building at 650 Fifth Avenue and Iran.

The skyscraper was majority owned by the Alavi Foundation, a non-profit organization that promotes Islamic culture and the Persian language. The 36-story, 382,500 square-foot building stands at the corner of Fifth Avenue and West 52nd Street, near Rockefeller Center and St. Patrick's Cathedral.

In a 2009 lawsuit, the Manhattan U.S. Attorney's office claimed the Alavi Foundation was controlled by Iran. It also said two minority owners, Assa Corp and Assa Co Ltd, were shell companies backed by Iran's Bank Melli.

Last year, U.S. District Judge Katherine Forrest in Manhattan federal court ruled that the owners were deliberately "shielding and concealing Iranian assets," in violation of U.S. law, and that the skyscraper was subject to government forfeiture.

In March, Forrest ruled that a group of private plaintiffs, who won court judgments that they were victims of or affected by attacks aided by Iran and who had filed claims against the building, were entitled to take control of the skyscraper and other properties owned by the defendants. Plaintiffs include families of those killed in the 1983 bombing of the U.S. Marine barracks in Beirut that killed 241 military personnel.

In her rulings, Forrest did not address whether the government or the private plaintiffs had priority over the properties. The settlement gives the plaintiffs priority.

"With this settlement, we have taken an important step toward completing what will be the largest ever terrorism-related forfeiture and providing a substantial recovery for victims of terrorism," U.S. Attorney Preet Bharara said in a statement.

The sale of the properties is not imminent. One private plaintiff has not joined the settlement and Alavi and Assa are expected to appeal Forrest's decisions.

The building generated close to $39 million in rental income from 1999 through 2007, according to the government's lawsuit.

Jamie Bernard, a lawyer for some plaintiffs, said the settlement was the result of a "tremendous amount of effort" by the U.S. Attorney's office in the Southern District of New York and the private plaintiffs.

Daniel Ruzumna, a lawyer for Alavi, declined to comment on the settlement. Lawyers for Assa did not return requests for comment.

According to the settlement, the government will recoup litigation and sales costs of any of the properties forfeited and subsequently sold by the U.S. Marshals Service. The rest of the proceeds will be distributed to the plaintiffs at a rate based on the unpaid damages awards they won in court judgments.

The case is: In re 650 Fifth Avenue and related properties, U.S. District Court, Southern District of New York, No. 08-10934.