Samoan man sentenced to prison for burglary and theft spent nearly five more years behind bars than he needed to because of an administrative error, according to a report.

Sio Agafili, a 45-year-old who should have been released from custody in December 2015, only walked out of the Tanumalala prison last week after a judge trying him in a separate case noticed the mistake, The Guardian reported.

“I lost count of the days,” Agafili told the Samoa Observer newspaper. “I don’t remember much about when I should be out, I just know I had to serve my time.”

Upolu Island in American Samoa, where Agafili was being held. (iStock)

Upolu Island in American Samoa, where Agafili was being held. (iStock)

MISSING SEOUL MAYOR'S BODY FOUND AFTER MASSIVE SEARCH

The ordeal began in November 2008, when Agafili was convicted of burglary and theft and handed a seven-year sentence.

The following month, he was convicted again on unrelated counts of the same charges and sentenced to five years.

Yet instead of serving both sentences concurrently – as is the standard in the Samoan criminal justice system – Agafili apparently was serving them consecutively, The Guardian reported.

A judge spotted the error during a hearing over an assault that Agafili allegedly committed during a prison breakout in March.

CHINESE AUTHORITIES DETAIN OUTSPOKEN CRITIC OF XI JINPING

Police in that case admitted Agafili was being held illegally and he was granted release on bail, according to The Guardian.

But by that point, Agafili had already served four years and eight months more than he needed to.

His lawyer Muriel Lui told RNZ Pacific that “his right to liberty...  has definitely been breached” and expects to file a claim for compensation.

CLICK HERE TO GET THE FOX NEWS APP 

“I’m not quite sure what happened here in terms of how police entered into their system that it was cumulative instead of concurrent, but it definitely does raise questions in terms of other prisoners who are currently in there, and whether they are serving the right sentences,” Lui added.

The apparent error comes following a report from Samoa’s ombudsman last year highlighting problems in the island’s prison system, ranging from overcrowding to a lack of basic needs like running water, The Guardian reported.