San Francisco City Attorney Dennis Herrera sued the developer of the sinking Millennium condominium tower Thursday, alleging the builder violated the law by failing to disclose the building’s settlement issues despite knowing of the problem more than a year before the units came to market.

Herrera’s lawsuit, filed in San Francisco Superior Court, alleges developer Millennium Partners knew by 2008 — a year before it started selling condominiums — that the building had sunk almost 6 inches, well in excess of projections.

Millennium Partners had a legal obligation to tell prospective buyers about the sinking, Herrera said. In not doing so, the developer gained an unfair advantage over other developers it was competing against for sales, he said. The lack of information also put buyers at an unfair disadvantage as they weighed the pros and cons of investing in the tower. Essentially, Millennium Tower buyers were sold a lemon, Herrera said in announcing the suit.

“Part of my responsibility as city attorney is to protect San Francisco residents and taxpayers from unfair or unlawful business practices,” Herrera said. “Before they had sold a single condominium Mission Street Development LLC (Millennium Partners’ affiliate) knew it had sunk more than it was supposed to and that it was still sinking. Yet they didn’t tell homeowners as they are required to do so under the law. It’s that simple.”

He added: “Buyer beware doesn’t cut it here.”

“The allegations by the city attorney have no merit,” said P.J. Johnston, spokesman for Millennium Partners. “At the time of its completion in 2008 and throughout its entire sales process, 301 Mission had settled within predicted, safe ranges. Mission Street Development LLC relied on the expertise of renowned designers and engineers and complied with all state and local laws concerning the disclosure of information to prospective buyers.”

Herrera’s lawsuit is a cross-complaint of a previous lawsuit filed by building homeowners against the Transbay Joint Powers Authority, which is building the new Transbay Transit Center next door, saying the homeowners should have sued the developer and not the authority. It seeks unspecified monetary damages, which would flow to the homeowners, not the city of San Francisco.

Millennium Partners blames the structural issues on the Transbay Joint Powers Authority. It says the builder of the adjacent transit center has weakened the soil under its tower by pumping millions of gallons of groundwater from the area to create a dry construction site.

Herrera’s office subpoenaed Millennium Partners and Mission Street Development in September. The developer turned over more than 1,900 pages of documents related to the disclosures made to prospective condo buyers. The disclosures include reams of material related to possible flaws in the building such as inconsistencies in the lobby’s marble work — but didn’t delve into the fact that the tower may have been experiencing a greater than expected rate of settlement.

“They left out the most important detail,” Herrera said. “Nowhere that the city is aware of did Mission Street Development LLC disclose that the building had settled much more and much faster than it was supposed to. That is not just a bit of information that perspective home buyers would want to know; it’s a bit of information that the developer was legally required to provide.”

The 58-story high-rise at 301 Mission St. has sunk at least 16 inches and is tilting 2 inches to the northeast at the base.

Johnston said Herrera has “chosen to take the focus off finding a fix for the building and is instead attempting to divert attention from the real culprit here — a government agency that has behaved recklessly, caused damage to a previously existing building and still refuses to take any of the steps that are necessary to fix the problem.”

Johnston said the city’s lawsuit “has nothing to do with protecting public safety, the building or its residents. Instead, it’s an effort by the city of San Francisco to duck its responsibilities and avoid paying for the harm caused by TJPA.”

The Transbay Joint Powers Authority is composed of representatives from San Francisco, Caltrain and transit agencies from Alameda, San Mateo and Santa Clara counties.

A spokeswoman for the Millennium Towers Association, which represents about 400 homeowners, said it was “evaluating its own legal action” and possible lawsuit. It declined to comment on Herrera’s suit.

“We want to take a close look at the lawsuit and figure out what it means,” said spokeswoman Evette Davis. “There’s a lot of legal action across the spectrum.”

On the 50th floor of the troubled building, two residents said Thursday that, notwithstanding Herrera’s suit, they still feel without recourse for the $4 million they believe they were cheated out of when they bought their unit in 2011.

“We believe a criminal lawsuit should be filed against the developers,” said Frank Jernigan, a retired software engineer who lives with his husband, physician Andrew Faulk, in a panoramic-view apartment overlooking the bay.

“Our safety is at risk, not just our investment,” Faulk said.

Jernigan and Faulk became an Internet sensation a week ago when they posted a video of a marble rolling irregularly across their kitchen floor in the direction of the building’s lean. After Herrera filed his suit, the two men retrieved their famous marble and rolled it several more times in several other locations within their unit with a reporter watching. Again, the marble rolled in one direction, stopped, changed course and rolled in the direction of the tilt.

“It shouldn’t be doing that,” Jernigan said.

The authority blames the sinking on the developer choosing a foundation with relatively short piles rather than drilling down to bedrock. Homeowners have also sued the developer, saying the foundation, which uses 90-foot piles rather than the 225-foot piles that would have reached bedrock, is insufficient.

The complaint is civil, and Herrera said that he has not referred the case to the district attorney for a criminal investigation. He said he is unaware of any criminal investigation into the case. “We don’t see any evidence of criminal activity here,” he said.

J.K. Dineen and Steve Rubenstein are San Francisco Chronicle staff writers. Email: jdineen@sfchronicle.com, srubenstein@sfchronicle.com Twitter: @sfjkdineen @SteveRubeSF