An investigation has been launched after a pornographic film was accidentally shown during the funeral of a father and his baby son.

Hundreds of people had gathered at the council-run Thornhill crematorium in Cardiff to pay their respects to the pair, who were killed following a car crash.

Mourners were shocked when one screen began to show a pornographic video instead of a tribute to the father, who died on New Year’s Eve. Cardiff council has launched an investigation.

A spokesman said: “The council has forwarded a written apology to the family and is carrying out an urgent investigation. There were four television screens used to display visual tributes as part of this funeral service.

“The television screen which showed the inappropriate content was recently installed, replacing a screen which was broken. We are trying to establish if the new screen - which is a smart television - could have accepted or picked up a broadcast by accident via Bluetooth or across a Wi-Fi network.

“The other three screens, which aren’t smart TVs, were unaffected. We are clear that it isn’t possible for any member of staff to play or download anything on the computer that links to the screens in the chapel. The screen has now been completely disconnected until audio visual engineers carry out a thorough investigation.

“We would like to take this opportunity to send our sincere apologies to the family, their relatives, friends and mourners at the funeral.” One mourner said the film played for several minutes before engineers could shut it down.

The Rev Lionel Fanthorpe, who led the service, said: “I remember looking up at the screen and seeing some type of video come on and a very loud noise.

“I look at my congregations instead of the TV screen, but when I heard this noise and members of the congregation moving towards the screen, I realised something was wrong. Members of the family were very distressed. Thankfully an engineer came to fix it and turn it off. It seems to be some kind of electronic accident.”

A spokeswoman for the family said they would not comment until the investigation into what happened was complete.

The father was killed in the car crash in Cardiff. His pregnant wife was also in the car. Following concern about the health of the unborn baby, he was delivered by emergency Caesarean section but died the same day.

Funeral directors James Summers & Son said: “As the crematorium operator, Cardiff council facilitated the digital display of the images during the service. We have requested they launch a full investigation to explain how such a distressing incident could happen.”

A family tribute issued by South Wales police following the accident described the father as a “very popular man who lived for his family”. It added: “He was a wonderful father and husband who was looking forward to the birth of his son. He will never be replaced.”

A man has since been charged with causing two deaths through dangerous driving, aggravated taking of a vehicle without consent, driving while disqualified, and driving without insurance in relation to the accident.