Former Rangers manager Walter Smith has admitted that the club's finances were in a "pretty perilous state" when it was sold to Craig Whyte in 2011.
Mr Smith was appearing as the first witness in the trial of Mr Whyte, who is accused of a fraudulent acquisition of Rangers.
Mr Whyte faces two charges relating to the purchase of Rangers, one of fraud and another under the Companies Act.
He has pleaded not guilty to both allegations.
Giving evidence to Mr Whyte's defence QC, Donald Findlay at the High Court in Glasgow, Walter Smith said the club had a bank overdraft of about £18m in 2011 when he first heard that Craig Whyte would be its new owner.
Walter Smith spent two spells as manager at Ibrox before leaving three days after Craig Whyte took over ownership in 2011.
He acknowledged that Rangers' finances were "distressing" at the time and said a lack of investment or development in new talent had impacted on the club's performance.
Mr Findlay asked him: "Around the period in 2011, did you know how bad things were financially at Rangers?"
Mr Smith said: "Not exactly, because we had had success over the period which I felt was helping the club lower the level of debt that it had, the exact amount I couldn't tell you."
Mr Findlay asked whether the club had been given an indication from the bank that it "had had enough of bank-rolling Rangers".
"Yes, we had an indication of that prior to 2011," he said.
Also giving evidence was former Rangers star player Ally McCoist, who took over management duties from Walter Smith in 2011.
Mr McCoist, who described himself as a "football analyst", told the court that he was aware of pressure being put on Rangers over its debts.
However, he said he was unaware the club had a bank overdraft of £18m and thought the figure was more like £14m.
Mr McCoist told how he first met Mr Whyte during a "brief encounter" at Glasgow's Hilton Hotel.
The former Rangers striker revealed how he later had discussions with Mr Whyte after he took over the club.
Prosecutor Mr Prentice asked the 54 year-old if he had "difficulties" in boosting the squad.
Mr McCoist said: "Yes, there were a number of players we would have liked to have got.
"Grant Holt at Norwich and a lad who played in Israel - Hemed.
"But, I just felt the offers being made were certainly not realistic enough for a chance to get the players."
Mr McCoist admitted signings were made but not, in his opinion, ones which kept the team at the "same standard".
He also agreed that he had "no discussions" with Mr Whyte about the terms of his contract when he took over as manager.
Craig Whyte is accused of pretending to former Rangers owner Sir David Murray, and others, that funds were available to make all required payments to acquire a "controlling and majority stake" in the club.
The funds included clearing an £18m bank debt, £2.8m for the "small tax case" liability, a £1.7m health-and-safety liability and £5m for the playing squad.
The Crown alleges Mr Whyte had only £4m available from two sources at the time but took out a £24m loan from Ticketus against three years of future season ticket sales "which was held subject to an agreement or agreements being entered into between the club and Ticketus after said acquisition".
The second charge under the Companies Act centres on the £18m payment between Mr Whyte's Wavetower company and Rangers to clear a Bank of Scotland debt.
The trial before eight men and seven women continues.