(CNN) Donald Trump walked up to a gold genie lantern, adorned with glowing red lights, and rubbed the side of it. Smoke swirled around him and a cracking sound filled the cavernous hall. On a theater-sized screen, the genie appeared.

"Good evening, master," the genie said to Trump.

It was April 1990, and the palatial Trump Taj Mahal casino in Atlantic City was sold out on its opening week, drawing crowds by the thousands.

Trump paraded around with A-listers from Michael Jackson to New Jersey's governor. Throngs of people shouted "Donald! Donald!" as he walked across marble floors and oversized plush carpets that sat beneath $14 million worth of Austrian crystal chandeliers.

"They talk about a million dollars a day," Trump told reporters -- a response to claims that the casino needed to bring in huge funds to cover its debt. "I think we've done that in the first few hours."

Today, the Taj Mahal's now-faded and frayed façade reveals what Trump wasn't saying in 1990: that his casinos were failing -- and that he almost brought down the city.

Trump has said he got out of Atlantic at the right time and that he left a rich man.

I made a lot of money in Atlantic City and left 7 years ago, great timing (as all know). Pols made big mistakes, now many bankruptcies. — Donald J. Trump (@realDonaldTrump) July 6, 2016

But financial and legal records obtained by CNN through the Freedom of Information Act offer a glimpse into how he struggled and maneuvered his way through a near financial collapse.

After Hillary Clinton trashed Trump's business record in Atlantic City, he released a statement saying he "created thousands of jobs and made a lot of money in Atlantic City, which was what, as a businessman, I am supposed to do for my company and my family."

The Trump campaign did not respond to CNN's request for comment on this story.

The grim behind the glitter

On April 18, 1990, just two weeks after the Trump Taj Mahal opened its doors, Trump sat down for an interview with CNN's Larry King, in a suite at the new casino.

"The Taj Mahal is a tremendous success. The things that I do are trophies," Trump told King.

At this point, the Taj Mahal had already experienced four days in which its bank account contained less than zero dollars, with deficits as deep as $1.7 million dollars. It had been open for only 16 days, according to a New Jersey Division of Gaming Enforcement report from 1990.

The lack of money raised so many red flags that, by June, the state's Division of Gaming Enforcement began monitoring the Taj's bank balances on a daily basis -- a very unusual practice, according to a former Casino Control Commission regulator.

The regulator told CNN recently that the opening of the Taj Mahal was "especially absurd," particularly because of its high debt.

Trump already had other Atlantic City casinos -- the Castle, Regency and Penthouse -- and they were cash drains, according to a report issued by the New Jersey Casino Control Commission in August 1990.

They were "generating an insufficient level of cash flow" that was pushing the Trump Organization towards "financial collapse," the report said.

Trump himself had a lot on the line as well. The Trump Organization was approximately $3.4 billion in debt, $832.5 million of which was personally guaranteed by Trump, according the 1990 Casino Control Commission report.

The New Jersey Division of Gaming Enforcement's report chronicled the dire condition of the Trump Organization, revealing that it wasn't bringing in enough money to support daily operations or its debt.

Trump used junk bonds at high interest rates — even though he had testified before the casino commission that he wouldn't, according to the former Commission regulator.

At the time of the Taj Mahal's opening, a number of slot machines were failing. Trump told King that this was because the machines were "too hot" -- so busy that they shut down. However, reports at the time showed that Trump's back of the house couldn't keep proper track of the money coming in and out of the machines.

During the first month, the Taj's revenue fell below forecasted levels. And this trend continued through the summer.

The Casino Control Commission began fielding calls and letters from contractors angry they hadn't been paid by the Trump Organization. At least four lawsuits were filed in just one month claiming as much as $80 million, according to the August 1990 Division of Gaming Enforcement report.

Trump offered to pay $20 million in cash to contractors, and issued notes for the remaining $50 to $60 million over the next five years.

The '11th hour' save

There was a deadline hanging over the Trump Organization's head: June 15, 1990.

Trump had a personal loan payment of approximately $28 million due, and Trump Castle had to come up with $20 million, according to the Division of Gaming Enforcement report. Trump Castle couldn't make it -- it was in default, though with a 10-day grace period.

Then on June 26, in what the Casino Control Commission describes as "an 11th hour" save, Trump sought a $65 million dollar loan from nine banks -- $20 million was handed out that day, allowing the organization to make its immediate payments.

Trump in front of slot machines at the Taj

Though the payment would buy Trump more time, it put strict stipulations on himself and his company and demanded a limit on his personal spending -- $450,000 per month that year and decreasing over the next five years, the Division of Gaming Enforcement report states.

While there were no agreements for Trump to sell off some of his belongings or companies, gaming authorities noted that he may have to do so in order to ensure the survival of the Trump Organization.

The fear of one casino's collapse creating a "ripple effect" to Trump's other properties and then to Atlantic City itself, worried casino commissioners.

"The risk of substantial economic disruption at the casinos will be less with the restructuring than it is without it," Valerie Armstrong, Casino Control Commission chairwoman, said at the time

In the end, the Casino Control Commission approved the $65 million bailout.

"If you have those casinos going out, eventually some of those people are going to locate at other casinos, but not the entire workforce—which then constitutes a drain economically on Atlantic City," commission member, David Waters, told CNN at the time.

The former Casino Control Commission regulator said that while they could have pulled his licenses at any point, they chose not to do so because it could have had a devastating impact on the gaming industry, Atlantic City and the state.

"We had a great victory," Trump told CNN after the 1990 hearing on the bailout. "I'm happy as hell."

The Taj Mahal filed for Chapter 11 bankruptcy in 1991.