It is the stuff of financial nightmares. You get one digit wrong on the sort code, and send a huge amount of cash to the wrong person. They refuse to return it, and the bank washes its hands of the matter, blaming you for the mistake.

That’s what happened to Peter Teich in a case that reveals shocking lapses in Britain’s banking system. Just hours after a solicitor sent the Cambridge resident his £193,000 inheritance after the death of his 100-year-old father, it became apparent that a terrible mistake had been made.

Teich had given his correct name, address and Barclays account number in Cambridge to his solicitor – but the wrong sort code. The money went straight to another Barclays customer, also in the Cambridge area who, alarmingly, had an account with the same number as Teich, though a slightly different sort code. Worse, the person refused to return the money. Barclays knew where his £193,000 was sitting and, Teich says, knew when the recipient dishonestly began to withdraw the cash.

Q&A What is confirmation of payee? Show From the end of March next year, name checks will be carried out when UK bank customers send money to other people. The move is designed to tackle the rapidly-growing problem of bank transfer fraud. But there has been criticism of the fact that it has been delayed – it was originally set to start last summer, according to reports. At the moment, anyone wanting to transfer money is asked for the recipient’s account name, account number and sort code. However, it’s typically the case that the bank does not check if the account name is correct. The so-called “confirmation of payee” system that is being introduced from 31 March 2020 will mean customers can check they are paying the right person. When a customer sets up a new payment, their bank etc will be able to check the name of the person or organisation they intend to pay against the actual name held on the account. There will be three possible outcomes. If they used the correct account name, they will receive confirmation that the details match, and can proceed with the payment. If they used a similar name to the account holder, they will be provided with the actual name to check. They can then update the details and try again, or contact the intended recipient to check the details. But if the customer enters the wrong name for the account holder, they will be told the details do not match and advised to contact the person they are trying to pay.

The mistaken transfer – called “misapplied funds” in banking parlance – could not have occurred if UK banks matched up sort codes and account numbers with the account holder’s name. But they do not. A recipient’s name could be given as Mickey Mouse and the bank would still process the payment, using the sort code and account number alone.

The banking industry promised that from mid-2019 name checks would be carried out when customers sent money to other people, largely to halt a rising tide of bank transfer fraud. But the timetable was delayed, and it will now not come into force until the end of March next year.

An oddity in Teich’s case is that Barclays also appeared to have identical account numbers for two different customers, both in the Cambridge area.

Teich realised the error almost immediately. His father’s estate was divided with his sister, who emailed him at noon on the day of the transfer, 26 April, to say she had received her £193,000. Teich checked his account, found nothing there, and contacted his solicitor. Only then did he discover he had given the solicitor the wrong sort code. The solicitor immediately contacted Barclays, which said the money would be restored within a week, according to Teich. But in late May, Teich received a bombshell letter from Barclays: “Due to an error on your part, the funds were applied to another customer … clearly you were mis-advised about the funds being restored to your account, and in recognition of this, I have credited your account with a small token gesture of £25.”

Barclays said it asked the person who received the cash for permission to return the money, but he refused. In a letter a few days later to Teich’s solicitor, it said: “Regrettably we have not been able to gain permission from the recipient of these funds for them to be returned to you. As there has been no error here on the part of the bank, we cannot just simply return the funds.”

Barclays would not provide the name of the person who received the cash. Photograph: Kirsty Wigglesworth/AP

No one is legally entitled to keep money that has been wrongfully credited to their account. But compelling them to return the money, particularly if it is spent, is another matter. Barclays, in common with other banks, will not even provide the name of the person who has received the cash, unless it is instructed by a court.

Some Guardian readers may recognise Teich’s surname, as his father, Mikuláš – from whom he inherited the £193,000 – was the subject of an obituary in the paper in April. Mikuláš escaped from Nazi-held Czechoslovakia in 1939, although his parents perished in the Holocaust. He later became a renowned historian of science at Cambridge.

Despite being 74 and disabled, Peter Teich was left on his own to recover his father’s £193,000. “Barclays insisted that I bear the full and sole responsibility of pursuing their own dishonest customer,” he says. He hired lawyers and went through an expensive and laborious two-stage legal process. In June, after £12,000 in legal and court fees, he got the other Barclays customer’s name. Armed with this, he then went to the high court to obtain a freezing injunction – at a cost of £34,000. Finally, after an “unnecessary, expensive and stressful process”, the court order forced the other Barclays customer to repay the cash.

It would’ve taken Barclays a few days to recover the misdirected funds, but they did nothing Peter Teich

“I freely acknowledge my mistake in this unhappy saga: I provided the sort code of the wrong Barclays branch. But my error fades into near insignificance when considered in the context of Barclays’ conduct,” says Teich.

The saga did not stop there. Teich asked Barclays to refund the £46,000 in legal costs he racked up simply to recover his own money. Barclays refused. Angered by the bank’s reply, Teich contacted the Guardian for help. We asked it to reconsider his case, and in an almost immediate U-turn, it has now agreed to pay all his legal fees, and has offered him £750 in compensation.

In a statement the bank said: “It is evident that on this occasion we have failed to meet the high standards that Mr Teich can expect to receive from Barclays, and for this we have offered our sincere apologies. After taking a closer look at this situation, we can confirm that Mr Teich can expect the fees he has incurred to be refunded in full with interest, together with a payment for the distress and inconvenience this matter has caused.”

Teich is jubilant he will now no longer be out of pocket. But he regrets Barclays’ behaviour. “It could have taken Barclays a few days to recover the misdirected funds, but instead they did nothing. They could have saved me and everyone else all this stress and anxiety. Had the confirmation of payee measures been in place at the time of the transfer, I would not have gone through the costly process of recovering my funds. All the same, Barclays could have done the right thing and intervened when there was still time to do so.”

• Update: Man handed £193,000 in sort code error says he tried to give it back