A mentally ill Perth bank manager who stole almost $3.7 million from his branch and gambled it away has been sentenced to five-and-a-half years behind bars.

Daniel Petkov, 37, was in the grip of undiagnosed bipolar disorder when he stole the money from the Westpac branch at Belmont between July 2016 and February 2018, when his offences were finally uncovered.

Petkov pleaded guilty to a charge of stealing as a servant, with the District Court hearing he falsified bank records and instructed his unwitting staff to do the same to cover up what he was doing.

Petkov stole the money from the Westpac branch between 2016 and 2018. ( Reuters: Steven Saphore )

The court was told Petkov initially stole sums of around $50,000, but by the end of his offending he was taking sums of around $400,000.

Petkov used the money to fund his gambling addiction, which saw him spend up to 16 hours at a time on slot machines at casinos in Perth and Melbourne where he was given high roller status.

State prosecutor Gabrielle Clarke described Petkov's crime as "calculated and persistent", saying it had a negative impact on the bank and "cast a shadow" over staff at the branch.

However, she said the state accepted the theft was a direct result of Petkov's mental illness.

Petkov's lawyer Tom Percy said at the time of the offences, the undiagnosed bipolar condition was "controlling" his client, but he was now receiving treatment and taking medication which meant it was in remission.

Bank workers deceived and betrayed: judge

Judge John Prior accepted that Petkov was genuinely remorseful for what he had done and that he had taken steps to rehabilitate himself.

He also accepted Petkov's mental illness was a significant mitigating factor, saying the offences were not "self induced" and appeared to have happened when he was in "a manic phase" of his disorder.

If you or anyone you know needs help: Lifeline on 13 11 14

Lifeline on 13 11 14 Gambling Help Online on 1800 858 858

Gambling Help Online on 1800 858 858 Beyond Blue on 1300 22 46 36

However, Judge Prior said the theft was very serious because of a number of factors, including the substantial sum of money taken, the attempts to conceal what was happening and the unwitting involvement of Petkov's staff, who were investigated when the theft came to light.

He said the employees felt deceived and betrayed because their integrity and honesty had been called into question.

Judge Prior also said Petkov had taken the money over a considerable period of time.

"It was a persistent and planned offence and it involved a significant and continued breach of trust," he said.

Judge Prior made an order that Petkov repay the money, but he said in reality it was unlikely any of it would ever be recovered.

Petkov will have to serve three and a half years in jail before he can released on parole.