Philip Havers, for the attorney general, told the high court the man was fearful of going out into his local community, had been verbally abused and was undergoing counselling.
'The broadcast has had a profound effect on my life,' the man said in a statement read by Lord justice Auld and Mr justice Ouseley.
They were hearing submissions from Mr Havers, and Andrew Caldecott for the BBC, about the contempt which the BBC and journalist Sally Mountjoy have admitted.
Mr Havers said the victim was named by Ms Mountjoy in a Spotlight News report broadcast twice earlier this year. It ran on local TV in the south-west and related to an ongoing criminal trial.
The man was the first of a number of complainants to give evidence at a trial alleging sex abuse many years ago.
Before he gave evidence he was reassured by police he had the benefit of anonymity for life. Before going into the court, the man confirmed who the court ushers were to ensure they did not know him.
Mr Havers said the man was so ashamed and embarrassed about what happened to him that - after he gave his statement to police - he only told his wife of physical abuse not sexual abuse.
But, after he gave evidence and was due back in court the next day, he and his wife watched the BBC broadcast in which his name and age were given, as well as details of his testimony about the sexual abuse.
'He says he was, not surprisingly, devastated by what he heard,' Mr Havers said.
'His wife became angry and upset and failed to understand why he did not confide fully in her.
'He received a number of phone calls from friends asking what it was all about.'
He tried to bluff his way out by pretending the BBC had made a mistake, but he was very embarrassed and ashamed.
The man got no sleep that night and decided not to return to court, before changing his mind, realising 'I would be letting other victims down if I didn't complete my evidence'.
Mr Havers submitted the broadcast created a substantial risk that the course of justice would be 'seriously impeded or prejudiced'.
The risks were that the man would decline to give further evidence; that if he did, he would be unable to continue and that other complainants may refuse to give evidence because of a fear they too would be named in the media.
Mr Caldecott told the judges no-one had checked Ms Mountjoy's report before it went to air. The report had 'come on the wire' only five minutes before the program began.
He said Ms Mountjoy, an experienced journalist and mother of three young children, was 'mortified by the mistake and deeply distressed by it'.
He said a 'basic safeguard' about not naming sex victims had been completely overlooked.
A resulting BBC inquiry had ordered remedial action to ensure it would never happen again, and a disciplinary hearing was awaiting the high court's decision.
Mr Caldecott referred to the 'sheer scale of court reporting' that the BBC broadcast every week, noting this was the first time this 'basic rule has been infringed' leading to a contempt hearing.
The judges gave their ruling later on Tuesday.
The BBC was fined£25,000 and a journalist£500 for broadcasting the name of a man who was giving evidence of being sexually abused as a child.
The high court found they had breached the life-long 'cloak of anonymity' given to witnesses testifying about sexual abuse.
Lord justice Auld, sitting with Mr justice Ouseley, agreed with the trial judge's conclusion that the identification was a 'catastrophic error causing untold damage to the witness'.
The man had described the devasting effects on his life. He was fearful of going out into his local community, he had been verbally abused and was undergoing counselling.
He had moved out from the home he shared with his wife, as she could not understand why he had not confided in her about his past.
The BBC and senior journalist Sally Mountjoy had admitted being in contempt of court in a Spotlight News program report broadcast twice earlier this year.
As well as the fines, Lord justice Auld ordered the BBC to pay the attorney general's legal costs of bringing the case to court. They are£12,399, while the BBC's own costs are estimated to be£10,000.
The broadcasts ran on local TV in the south-west and related to an ongoing criminal trial of a man accused of indecently assaulting children many years ago.
The witness, who was the first of a number of complainants, gave evidence and was due to continue the next day when he was named by the BBC on air.
Before giving evidence at the sex abuse trial the man had sought - and received - assurance from police that he would not be identified.
He attended court without his wife and, as an additional precaution, had checked that the court ushers were unknown to him.
Lord justice Auld said the man had been ashamed and embarrassed and had been unable to disclose his past to anyone until he spoke to investigating police.
'He didn't even tell his wife about any abuse until he made a witness statement - even then he simply told her it was physical abuse and said nothing about sexual abuse,' the judge added.
But, when the couple watched the news that night, they saw Ms Mountjoy's report of the trial which gave his name, age and details of the sexual abuse he had given evidence about.
'Ms Mountjoy also specifically referred to the fact that it had been put to the witness in cross-examination that he had made up the allegations in order to secure compensation,' the judge said.
The man was devastated - his wife became angry and upset, failing to understand why he had not confided fully in her.
He received phone calls from friends asking quesitons, was unable to sleep that night and at first said he would not return to court to continue his testimony.
But he changed his mind because he felt he would be letting down the other complainants if he did not go back.
The trial judge later observed the man was in 'extreme distress' when he returned to the witness box.
The high court was told Ms Mountjoy was an experienced senior journalist, held in high regard by her colleagues.
She had been 'mortified by the mistake and deeply distressed by it' and could not explain why it happened.
Both she and the BBC had apologised, admitting a 'basic safeguard' about not naming complainants in sex cases had been completely overlooked.
'It is not a case where Ms Mountjoy or other staff involved were ignorant of the restriction,' said the judge.
No-one in the production team had checked the report before it went to air the first time - it had 'come on the wire' only five minutes before the program began.
And no-one checked before the second broadcast - probably because Ms Mountjoy's work was so highly regarded, Lord justice Auld said.
He found the broadcast created a substantial risk that the course of justice would be 'seriously impeded or prejudiced'.
The witness may have been unwilling to return to court or, if he had, he may have been unable to continue giving evidence or to do himself justice in the witness box.
Further, the identification could have deterred other witnesses from testifying because of a fear they too would be named in the media.
The judge accepted the error was an isolated incident by an experienced and highly regarded journalist, but he noted it had been an 'elementary mistake'.
While accepting the program had worked to tight deadlines, he noted 'it must be the daily stuff of television reporting'.
The court was told a resulting BBC inquiry had ordered remedial action to ensure it would never happen again, and a disciplinary hearing was awaiting the high court decision.
STRAND NEWS SERVICE