A New York City man was sentenced to 27 years in prison Friday for traveling to the Middle East in a failed bid to join al-Qaeda and avenge abuse of Muslims by killing American troops.

I wish I had not gone down that path, Betim Kaziu told U.S. District Judge John Gleason before hearing the sentence in federal court in Brooklyn. I completely regret what I did in that phase of my life.

But Gleason said it was first time he’d hear the defendant express remorse – and that it wasn’t convincing.

You grew up in Brooklyn and you decided to murder your own country’s soldiers, Gleason said. There’s still an element of defiance in you. … You’re still way too proud of becoming a jihadist.

The government had sought a life term,arguing that Kaziu could resume his quest to commit terrorism if given anything less.

A jury found the 24-year-old Kaziu guilty last year of conspiracy to provide material support to a terrorist organization and other charges last year at a trial that featured the testimony of a would-be terrorist and childhood friend of the defendant who became a government cooperator.

Unlike the cases of Najibullah Zazi,mastermind of a foiled suicide attack on New York City subways,or Faisal Shahzad,the failed Times Square bomber,Kaziu’s case received little attention,in part because the plot didn’t get far. But his story had many of the same themes of homegrown terrorism.

Kaziu and star witness Sulejah Hadzovic were two U.S.-born sons of Islamic immigrants from the former Yugoslavia who met in sixth grade. By 2008,they pursued a growing interest in radical Islam and began searching the Internet for opportunities to take up arms against U.S. troops.

We were upset at what was happening in places like Abu Ghraib prison and Guantanamo Bay,how they were humiliating and torturing Muslims there, Hadzovic testified. It’s what ultimately made us want to go and fight in jihad.

The pair traveled in 2009 to Egypt,where Hadzovic said they attended school,sought to obtain AK-47s and considered whether to take up arms in Iraq,Afghanistan,Pakistan,Palestine or Somalia.

Hadzovic said he began to waver after hearing President Barack Obama’s speech in Cairo in 2009 that extended a hand of friendship to Islam. Kaziu,he said,told him: Don’t let (the speech) fool you. It’s like throwing sand in your eyes to blind you from the truth.

Defying his friend,Hadzovic returned to New York. About three weeks later,federal authorities approached him and demanded answers about his travels. He eventually agreed to plead guilty and cooperate.

Prosecutors say that once on his own,Kaziu tried,but failed,to join al-Qaeda groups in Iraq,Afghanistan and the Balkans. He eventually made his way to Kosovo.

On the Albanian coast,he recorded a video that a prosecutor described as his goodbye,contemplating how he would soon depart for paradise,a reward for those who die a martyr, and had bought a plane ticket to Pakistan. But he was captured by local authorities before he could make the trip.

The defense claimed the alleged martyrdom video and other home videos shot by Kaziu were made in jest. His lawyers also argued that most of evidence against their client was widely distributed anti-American propaganda.