A Royal Marine who made bombs for dissident republicans suffered post-traumatic stress disorder after a 2002 sectarian beating, a court has heard.
Ciarán Maxwell, now 31, was injured in a sectarian attack in his hometown of Larne, County Antrim, when he was 16.
He has admitted offences including bomb-making. The Old Bailey heard he bought bomb-making materials online and sent them to his grandmother's house.
The London court hearing will determine the length of his jail sentence.
Maxwell was not in court, but appeared by video link from Woodhill Prison in Milton Keynes.
On Thursday, a defence barrister said Maxwell "feared violence" on a daily basis as he grew up as a Catholic in his hometown of Larne.
In 2002, he was "beaten by golf clubs, iron bars and hammers" and "left for dead in a field".
'Motivated by hostility'
The court was told that a doctor's report said Maxwell had suffered from post-traumatic stress disorder (PTSD) in the immediate aftermath of the attack, and that condition had persisted into his 20s.
But earlier, a prosecutor said there was "no direct evidence" that Maxwell's offending was motivated by the beating he was subjected to by loyalists.
Instead, he was "motivated by dissident republican sympathies and a hostility broadly to the United Kingdom", prosecutor Richard Whittam QC said.
The court was told that in later years, Maxwell feared that being identified as a member of the British military would put his family in Larne under threat from republicans, and that they may even be killed.
Maxwell now fears for the safety of his family because he has co-operated with police since his arrest, the defence added.
'Bomb-maker on leave'
"He was in over his head and the PTSD presented some difficulty in dealing rationally with the situation," the barrister said.
The case was one of "contradictions", he added.
"He was Marine by day and it would seem republican bomb-maker on leave."
The court also heard that Maxwell had once given a presentation to other Royal Marines on the security situation in Northern Ireland.
He was due to be promoted to the rank of corporal before his arrest, and was described in court as someone who would have been thought of as a "successful member of the military".
"He was an obsessive in his planning, someone who was a record keeper, organised and he liked to be tidy and made copious notes," the defence barrister said.
'Potential for death'
The prosecution revealed the marine had set up 43 weapons hides across England and Northern Ireland.
More than half of those hides were discovered in or near Maxwell's hometown of Larne, while another 19 hides were found at Powderham New Plantation, close to his home in England.
Two of the pipebombs he constructed were used by dissident republicans after his arrest in August 2016 and had "clear potential to cause death and injury".
Maxwell stole items from his military base, including a detonation cord and detonators, the prosecution added.
Some of the items "must have been taken by him from England" when he travelled home to Larne by ferry, said Mr Whittam.
He cited bullets as an example of that and suggested it may have been easier for Maxwell as he would have been able to show military identification.
"There is concern he might have found it easier to travel between England and Northern Ireland because of the ID he would have had," the prosecutor said.
Other materials for making the explosives, including chemicals and equipment, had been bought online and sent to his late grandmother's house, Mr Whittam told the court.
The defence said Maxwell started making explosives as "a rather unusual hobby" with a man in Larne who was later jailed for explosives offences.
Niall Lehd had known Maxwell since their days as pupils at the same school and the Marine had gone for a drink with him while on leave.
The court heard Lehd told Maxwell he was a member of the dissident republican paramilitary group, the Continuity IRA.
During the drinking session, the Marine "ended up saying a little bit too much" and was identified as "being of use" to dissident republicans.
"Lehd was the instigator, enthusiasm and driving force, a very sinister figure indeed," the defence barrister told the court.
"Maxwell has made some very bad decisions that will haunt him and members of his family for a significant amount of time to come."
During Wednesday's hearing, the court was told that Maxwell had drawn up a list of targets and address of police officers, military staff, an MI5 member and loyalists.
Maxwell lived in Exminster in Devon, and was based with 40 Commando in Taunton, Somerset.
His arrest came after a search near Exeter found hides with a range of explosive substances, as well as ammunition, weapons and tools for making bombs.
He has also pleaded guilty to drugs and fraud charges.