Three years ago, Los Angeles city officials demanded that builders halt work on a colossal mansion in the rarefied hills of Bel-Air.

The massive home was bigger and taller than allowed, city prosecutors said. It also included entire areas — bedrooms, decks and a vast IMAX theater — that the city says were never approved.

Neighbors said they feared for their safety, complaining that the project had dangerously destabilized the hillside above their homes.

City officials yanked the building permits. Luxury developer Mohamed Hadid was slapped with criminal charges. The case drew international attention with its cocktail of criminal accusations, real estate excess and star power in Hadid, who has appeared on “The Real Housewives of Beverly Hills” and whose daughters Gigi and Bella have graced magazine covers.

After more than a year of legal wrangling, Hadid pleaded no contest to the misdemeanor charges Tuesday. But neighbors remain anxious about an unanswered question: What will happen to the roughly 30,000-square-foot building uphill?

“You still have this horrendous thing hanging over the hillside,” neighbor Joseph Horacek, an entertainment lawyer, said recently at his home. He has nicknamed the unfinished building, which towers over his winding street below, the “Starship Enterprise.”

The question goes to the heart of how L.A. should hold real estate developers accountable for flouting city codes. Hadid, who did not appear in court Tuesday, is scheduled for a sentencing hearing next month on charges that include illegal construction and defying orders from the building department.

City prosecutors want the judge to impose at least three years of probation, hundreds of hours of community service, fines of $1,000 for each of the three charges, and a $250,000 contribution to a community improvement fund. They are also pressing for Hadid to make sure his contractor secures a bond to ensure that if the developer fails to finish construction legally, the city will have the money to demolish the unfinished building.

Critics have insisted that the bulk of the structure on Strada Vecchia Road should be torn down, arguing that if it is allowed to remain it will send a troubling message to wealthy developers willing to break the rules.

Hadid declined to be interviewed last week, instead providing written answers to questions through an attorney.

In the past, his legal team has argued that Hadid was not the one responsible for getting permits. He has scoffed at the idea of tearing down the mansion, reportedly calling it “insane.”

“Demolish this house? Never!” Hadid was quoted in Town and Country Magazine, adding, “This house will last forever. Bel-Air will fall before this will.”

Hadid, 68, is a stylish figure known for building grandiose estates such as the Palazzo di Amore, a Beverly Hills villa that was listed for $195 million and boasted a 15,000-square-foot entertainment complex including a ballroom with a revolving dance floor.

His daughters are supermodels, and his fiancée now stars on an E! reality show about women engaged or wedded to wealthy men. His Instagram account, which has more than 600,000 followers, bills him as “Real Estate Developer, Proud Father of 5, Olympian ’92, Artist and Creator of my own Dream World.”

At a hearing earlier in May in a Van Nuys courtroom, attorney Robert Shapiro said Hadid was seeking to get loans and complete the house so that it did not continue to languish.

As he argued for more time for Hadid to work things out with the city building department rather than heading to trial, he sketched out for the judge a troubling scenario: the mansion continuing to sit, unfinished, for years.

Last year, another of Hadid’s attorneys, Donald Ré, warned City Atty. Mike Feuer in a letter that lenders might foreclose on the building if Hadid were convicted, making it impossible for him to bring the building in line with city rules.

Hadid has turned in revised plans for a roughly 30,000-square-foot building, angling for new permits to finish it. Shapiro argued that the best outcome for everyone would be for Hadid to complete the house.

But city records indicate that the revised plans have not yet received a long list of clearances from the building department. In a lengthy set of notes, a plan checker pointed out that the Strada Vecchia plans were still not in line with city rules that restrict hillside construction, grading and building height.

Bruce Rudman, an attorney who represents Hadid in civil matters, nonetheless said that the plans were realistic, writing in an email that “corrections are often requested.” At the previous hearing, Senior Assistant City Atty. Tina Hess told the judge that based on what she had heard from the building department, it could take “the better part of a year” before permits are issued.

Hess also cast doubt on the idea that Hadid would not be able to finance the construction, saying that he had been proceeding with other projects.

Horacek argued that the revised plans were merely a stalling tactic to try to delay the trial. He and other critics are skeptical that Hadid can make the building match city requirements without tearing down most or all of it.

“The only path that I see is demolition,” said attorney Victor De la Cruz, who represents the Horaceks. Although Hadid has turned in revised plans that remove some unapproved features, “he is trying to keep the overwhelming majority of the work that he already illegally constructed.”

“It’s too little, and it’s way too late,” De la Cruz concluded.

Removing the unapproved areas might not be so simple: City records indicate that many of the unapproved sections sit underneath other parts of the building, including an “entire story ... created below basement level.”

Los Angeles has also imposed new, stricter rulesfor building in Bel-Air since Hadid started construction, which could complicate efforts to legalize the home. Under those rules, houses bigger than 17,500 square feet must undergo a more rigorous review that requires environmental studies and can include a public hearing.

Rudman, in response to questions about those potential challenges, wrote that “everything will be performed with the guidance of the city and project engineers.”

Horacek and other critics insist that the city should not treat the Strada Vecchia case as a matter of redoing some paperwork. City prosecutors say Hadid and his business associates repeatedly ignored the rules, including tearing down an existing home on the site without a permit and improperly grading the slope with illegal and hazardous cuts.

Even after the city demanded a halt to construction, work continued illegally on the site, according to a building department order.

“You can’t reward that behavior,” said Mike Eveloff, a board member of the nonprofit Fix the City, which argues that L.A. has allowed development to outpace the infrastructure and city services to support it. “The city has to make this an absolute red line — you cannot cross it, or the structure has to come down.”

Allowing the building to be legalized after the fact, De la Cruz said, would tell other developers “that it’s OK to violate the law and ask for forgiveness later.”

Rudman countered that Hadid had been working to address city demands and would ensure that the home was in compliance. He said in an email that retaining walls, interior walls and other features targeted by the city had already been demolished, and that “non-structural” parts of the lower decks had also been removed, making them unusable.

Rudman also emphasized that the building had been inspected over and over by the city while it was under construction.

Lawyers defending Hadid have raised that point before. Ré wrote last year that the theater — which he said was “simply a room with theater-style tiered concrete levels” — had previously appeared on aerial photographs delivered to the city.

“There is no possibility that it was missed by the inspectors at the time of construction,” Ré wrote.

Neighbors have argued that Los Angeles could eventually take matters into its own hands. Under the Municipal Code, the city can demand that a building be torn down if it is deemed a nuisance. City rules also state that if the building department believes that a structure poses an immediate danger, it can be torn down “without an order or notice of any kind whatsoever.”

Rudman responded in an email that “there is no merit to any claim the building is a nuisance.”

This is not the first time that building disputes have led to demands for a teardown. Six years ago, a judge ruled that L.A. had wrongly issued a permit to a Brentwood homeowner for a bridge that allowed him to drive his Ferrari into a showpiece garage in his living room.

During the dispute, his attorney complained that the city had repeatedly inspected the bridge “and no one raised an issue.”

But neighbors contested the bridge, arguing that it was a safety hazard that could set a troubling precedent across the city. “He had to take it down, and he did,” said Raymond Klein, president of the Brentwood Homeowners Assn.

In Pacific Palisades, neighbors challenged a controversial remodeling project, arguing that developer Mehr Beglari had improperly manipulated a formula for how far the building was set back from the street. The city ultimately revoked permits six years ago after a judge ruled that L.A. had ignored its own zoning rules.

Beglari defaulted on the house in March, according to county records. As legal battles over the home have continued, the disputed part of the Greentree Road house still stands, said Rob Wilcox, a spokesman for Feuer.

In both of those cases, Los Angeles gave its blessing to projects that werebuilt according to approved plans, then challenged by neighbors in civil court. In Bel-Air, however, city prosecutors are arguing that Hadid went beyond what L.A. had approved, spurring criminal charges.

“The law allows you to build whatever has been approved in accordance with zoning and planning rules,” said real estate attorney Lewis G. Feldman of Feldman Law Group LLP, who is not involved in the case. “If you fail to do that, all bets are off.”

Twitter: @LATimesEmily