Sohail Qureshi, 53, was among the ringleaders of a gang who allegedly exploited a flaw in the firm's online banking system during its takeover by RBS.
Mr Qureshi, of Newton Mearns, East Renfrewshire, co-led the transfer of £13.5m out of the UK, his fraud trial at London's Southwark Crown Court was told.
Jurors heard yesterday he hoped to pocket up to £20,220,629 after targeting a NatWest branch in St Helens, Lancashire.
They transferred £15m, of which £13.5m was sent to a bank account in Riga, Latvia, destined for Dubai between April 1 and July 31, 2004 - until Latvian authorities became suspicious, the court was told.
Prosecuting, David Aaronberg QC, said: "Over the May Bank Holiday period, when a cheque was paid into an account, its value showed on the internal screens of staff as being available for onward payment - even before it had cleared."
Realising this flaw provided an easy way to deceive the bank, allegedly worthless cheques were paid to a company run by two convicted fraudsters, the court heard.
Mr Aaronberg added: "By timing their activity to coincide with a Bank Holiday weekend, the worthless cheques would not bounce until the proceeds of the fraud had been moved through many other accounts."
It took NatWest a week to find there was no value in the account, he added.
Mr Qureshi was extradited from Dubai. The trial continues.