NEW YORK (CBSNewYork/AP) — A New Yorker who sent $67,000 to al Qaeda and pledged his support to the terror group was sentenced Tuesday to 15 years in prison by a judge who cited the defendant’s remorse and medical problems that make his incarceration more difficult than others’.

Wesam El-Hanafi, who was born in Brooklyn, said he’d spent the nearly five years since his arrest reflecting on his actions.

READ MORE: NYPD: Officer Shot 3 Times In Brooklyn, Suspect Shot By Police; Both Hospitalized

“I didn’t just make the wrong choices; I made the worst choices,” El-Hanafi, 39, said as he apologized. “I regret my actions. I’m embarrassed by what I did.”

Assistant U.S. Attorney John Cronan said El-Hanafi from 2007 to late 2009 “worked tirelessly to support al Qaeda” by contributing tens of thousands of dollars, by sending a remote-control toy car whose components could be used in an explosive device and by providing technical advice about computers, including encryption software so information could be transmitted without being detected.

Cronan said El-Hanafi also directed his co-defendant at al Qaeda’s request to provide surveillance of the New York Stock Exchange, though the one-page report they produced was rudimentary and of limited use.

The prosecutor argued that was only because El-Hanafi was upset about not being selected as a fighter to go to Afghanistan or Iraq, WCBS 880’s Irene Cornell reported.

“Wesam El-Hanafi was deeply involved in supporting al-Qaida both financially and by facilitating surveillance of a New York landmark to bring an attack to our homeland in our city,” U.S. Attorney Preet Bharara said in a release. “Today’s sentence is a fitting punishment for these crimes.”

In court papers, Cronan wrote that El-Hanafi had worked for years in New York City as an information technology specialist at a well-known investment bank, where he received extensive training in computer security.

READ MORE: New York City Begins Offering Pfizer Vaccine To Kids Ages 12-15 After CDC Approval

“He was living the American dream and then he turned his back on America and pledged allegiance to our greatest enemy,” the prosecutor told U.S. District Judge Kimba Wood in Manhattan. “The defendant was all in with al Qaeda.”

Defense attorney Sarah Kunstler had requested leniency, saying El-Hanafi had faced “abominable living conditions” over the past five years and was fully remorseful.

“He knows he must live with the horror of what he’s done,” she said.

El-Hanafi faced up to 20 years in prison after pleading guilty in June 2012 to providing and conspiring to provide material support to al Qaeda. The plea came two years after he was brought to the United States from Dubai.

Since the plea, lawyers have spent considerable time submitting evidence and arguing over medical problems El-Hanafi has developed, including a condition that makes it possible that blood clots will develop.

Wood said his medical issues, which emerged after his incarceration, give him limited mobility and capacity for activity in prison. She said he had suffered considerable pain in prison and faced “significantly harsher” living conditions as a result of his illness than other inmates.

MORE NEWS: After More Than A Year, The Show Must Go On: More Broadway Shows Announce Plans To Resume Performances

Citing the “unique factors,” she said the sentence was appropriate. It was three years less than his co-defendant, Sabirhan Hasanoff, received after pleading guilty to similar charges, though the government said Hasanoff was less culpable.