Members of a counter terrorism unit claim they were too stressed to have been on duty at a Pembrokeshire port.
Timothy Pawlett, 52, and Gareth Clement, 55, are accused of leaving their posts early or arriving late 126 times in three months at Fishguard Port.
They claimed full working hours, which resulted in a combined overpayment of £1,810, Swansea Crown Court heard.
Both officers deny fraud, saying errors were down to stress or personal issues.
Mr Pawlett, from Haverfordwest, admitted logging inaccurate working hours on 72 occasions, including one day when he arrived two hours late and left almost four hours early.
He told the jury he had been suffering from depression, stress and anxiety and had been studying full time for a degree in psychology.
"I would attend a full day at university and then complete a shift," he said.
"My depression was so bad that sometimes my mind was all over the place and I didn't know what I was doing."
'Brink of breakdown'
Mr Clement, from Crymych, admitted logging inaccurate working hours 54 times, but said he had not been dishonest as his "judgement was so clouded".
He told the court events in his personal life "took him to the brink of a breakdown".
He added: "I was on auto pilot. All I could think of was getting through the next 24 hours and getting home."
He said he suffered panic attacks at work and may have left early to avoid anyone noticing.
Both officers said they should have been off on sick leave.
The court heard they were members of the Welsh Extremism and Counter Terrorism Unit and monitored people and vehicles travelling on the ferry to and from Rosslare in Ireland.
Nicholas Gedge, prosecuting, said the pair were "rumbled" after their boss, Det Sgt Ian Hardy could not contact either of them "and became curious" to find they claimed to have been on duty.
The trial continues.