Every once in a while, Derek Twyman watched as men convicted of similar crimes as his were allowed to walk out of jail while he sat in his North Carolina prison cell, waiting for his day to come.

Twyman, a Canadian citizen who as teenager moved to North Carolina with his father, was sentenced to 160 years in prison after being convicted of a string of non-violent burglaries in 1989.

In November, Twyman finally returned to Canada as a free man after more than 27 years behind bars. Twyman was freed thanks to a group of Canadian lawyers who spent a decade fighting against Twyman’s excessively harsh sentence.

During Twyman’s trial in 1989, the judge in the case, Thomas Ross, handed down the 160-year sentence against the 25-year-old because of his previous convictions as a juvenile and Tyman’s perceived lack of remorse for the crimes. The man who helped Twyman commit the burglaries, Jason Southard, received a 50-year sentence for his role in the burglaries, but would be paroled after less than 20 years.

About five years after Twyman’s sentence, North Carolina laws changed so that similar crimes would only carry a maximum sentence of about 14 years. The law was not applied retroactively, so Twyman was not given a lesser sentence.

For decades, Twyman, now in his 50s, wrote to each North Carolina state representative, to senators, governors, lawyers and advocates to plead for help, but the letters yielded few results.

“There’s was times I didn’t (think I would ever get out), but I had to keep fighting,” Twyman told CTV’s Your Morning on Monday. “With the law change, I would have done six to nine months, times four, which was the four burglaries.”

In 2007, Twyman posted an ad for legal advice on Writeaprisoner.com, a website where inmates describe their cases and ask for help.

It was at this point a University of New Brunswick law student, Shane Martinez, took notice and began to look into the case with a team of fellow students and lawyers.

“It was a sentence that, on the face of it, was just so egregious, that we thought if we could get in front of the right people in North Carolina, that people would agree that, in fact, it was an unreasonable sentence,” Martinez told Your Morning.

Martinez and the team spent a decade raising awareness about Twyman’s story and trying to get the case in front of someone who could order Twyman to be released.

In 2016, Twyman left a voicemail for Halifax-based criminal attorney Mark Knox, who works with an organization designed to help criminal offenders reintegrate into society. Knox began to bring other lawyers and law students into the fold to help with the cause.

“(Knox) was absolutely imperative to the case being successful,” Martinez said.

Twyman’s big break came when James Craven III, a lawyer known for prosecuting members of the KKK during the civil rights movement, read about his story in a local newspaper article.

Craven contacted the judge who originally convicted Twyman to convince him to recommend a release. The judge’s recommendation to North Carolina’s parole board eventually helped get Twyman out of prison.

Finally, after more than 27 years behind bars, the parole board in North Carolina decided Twyman qualified for a full release in May 2017.

Twyman did not make it back to Canada immediately, however. On his way back to Canada in July, he was picked up by the U.S. Immigration and Customs Enforcement and put into a holding cell for 118 days. It is not clear why the U.S. customs agency detained Twyman.

In November, Twyman was released once again and finally arrived in Canada as a free man where Martinez was waiting for him at the airport. This would mark the first time the two men met face-to-face.

“You’re still in a little bit of disbelief because I’ve actually seen people where they were in prison and they tell them ‘you’re getting out this date or that date’ and something came up so it gets put off,” Twyman said.

“Really, all I was just looking for is a Canadian flag, so I saw that and I knew I was good.”

Twyman and Martinez are now looking at starting an organization to help the hundreds of Canadian citizens that are stuck in prisons abroad.

“(Many of them) have been subjected to situations similar to Derek’s,” said Martinez. “(They) have really been abandoned by the Canadian government (and) are looking for help.”