It's a story that begins with a man's diagnosis of cancer and ends up - 762 phone calls and a court case later - with one of the worst examples, according to the victim, of how banks dehumanise their customers.

When David Lloyd, 62, was told he had terminal lung cancer in January 2006, his wife, Annette Edwards, contacted their bank, the Halifax, to let them know of his predicament and that he would no longer be able to work. They applied for a payout on an insurance policy, and for state benefits, but while they waited for the money to arrive they went overdrawn.

Lloyd and Edwards, who had been a Halifax account holder for 15 years, claim the debt is around £800, but the bank says it is £4,000. The bank and its agents telephoned the couple 762 times over seven months in what they say is aggressive pursuit of the debt in calls made "morning, noon and night".

Lloyd, who worked for the Institution of Civil Engineers until his cancer diagnosis, has developed a phobia of telephones and suffers from anxiety and depression. Edwards says the couple feel dehumanised because their situation was ignored.

In May, the couple obtained a court undertaking at Leeds county court ensuring the Halifax would not contact them. Despite the undertaking, a letter from the Halifax arrived last Wednesday at the couple's home in Sale, Greater Manchester.

At Manchester Justice Centre yesterday, the Bank of Scotland, the parent company of the Halifax, appeared before a judge in a contempt of court hearing instigated by the couple. The bank's barrister, James Counsell, said: "The bank issues its wholehearted fulsome apology for the error and the serious breach of the undertaking which it very much regrets."

He said the bank had taken extensive steps to stop the correspondence and there had been no telephone calls since summer 2007. The bank paid £1,150 costs to the claimants and made a new undertaking to write to HBOS and ask its subsidaries not to contact the claimants using the Halifax logo.

The couple also claim that their daughter, Stefanie Moore, 29, received 60 to 100 phone calls and two text messages, yet wasn't even a customer.

It is doubtful that Lloyd, who has not been able to eat for 48 hours, will be alive when the harassment case comes to a full hearing in February. Edwards says of her husband: "He is prepared to put his head above the parapet because he doesn't want other people to go through what he has had to go through."

• This article was amended on Wednesday December 10 2008. David Lloyd worked for the Institution of Civil Engineers, not the Institute of Civil Engineers. This has been corrected.