South African Paralympic track star Oscar Pistorius has told his murder trial that the shooting of his girlfriend had left him sleepless, terrified and plagued by nightmares.

He also apologised to the mother of Reeva Steenkamp in the public gallery, saying he fired four shots through a toilet door in the early hours of Valentine's Day last year in the belief that he was defending her from an intruder.

"I was simply trying to protect Reeva," he told the court, his voice quavering with emotion.

He said: "There hasn't been a moment since this tragedy happened that I haven't thought about your family."

The double-amputee athlete said he wanted to protect Ms Steenkamp.

"He has said he killed her by mistake; prosecutors say he killed her after an argument.

Pistorius also said he is taking anti-depressant medicine and that he has sometimes woken up in terror, suffering from panic attacks.

Earlier he had wept and retched into a bucket during graphic forensic testimony.

If found guilty of murder, Pistorius faces at least 25 years in prison.