A New York City Imam caught up in the investigation into an aborted terror plot last September has been sentenced to leave the United States or face deportation.

Ahmad Afzali, an Afghan-born Imam who has spent most of his life in New York, had been charged with lying to investigators in connection with a foiled plot to bomb Manhattan subway trains. He was sentenced Thursday to time already served, and ordered to leave the U.S. permanently.

Afzali pleaded guilty in March to lying to the Federal Bureau of Investigation about his phone calls with the lead subway bomb plotter, Najibullah Zazi.

He faced up to six months in prison, but Federal Judge Frederic Block Thursday gave him no more jail time, but said he must leave the country within 90 days - or be deported.

Prosecutors had accused Afzali of telling Zazi that the police were asking questions about him, and then lying about those conversations. Investigators had contacted Afzali in September 2009, to ask him to get in touch with Zazi for them.

At the sentencing, Afzali said he was sincerely sorry and never intended to help those he called idiots. He said nothing could be harder for him than knowing that he was a convicted felon and had to leave the country that he loved. He later told reporters outside the courthouse that he had only hoped to help law enforcement, and that Zazi had betrayed Islam.

"He's an idiot for what he's been trying to do. Not only he gives himself a hardship and his family, but he's making it hard for every other Muslim to live in America. It's not Islamic law. I have no idea where they studied or where they got the ideology from," Afzali said.

Afzali said that he did not know which country he will be able to move to when he leaves the U.S. Two others from Queens have been charged with helping Najibullah Zazi plot the foiled bombings. A fourth was arrested overseas. Zazi has pleaded guilty and will be sentenced in June.