An imam linked to the suspects in an aborted homicide bomb plot against New York City pleaded guilty on Thursday to lying to the FBI — a deal sparing him serious jail time but forcing him to leave the country.

A tearful Ahmad Afzali told a judge in federal court in Brooklyn that he had wanted to help authorities in the investigation of the threat, but lied under grilling by the FBI about his phone conversations with admitted Al Qaeda associate Najibullah Zazi.

"In doing so, I failed to live up to my obligation to this country, my community, my family and my religion," he said. "I am truly sorry."

Under the plea deal, Afzali faces up to six months behind bars at sentencing on April 8. It also requires the Afghanistan-born defendant to leave the country within 90 days after completing the sentence or face deportation.

Afterward, he told reporters, "I just signed my death sentence."

Afzali, 39, was arrested in September as federal authorities scrambled to thwart a plot by Zazi, a Colorado airport van driver who pleaded guilty last week to terror charges. Zazi admitted that he tested bomb-making materials in a Denver suburb before traveling by car to New York intending to attack the subway system to avenge U.S. military involvement in Afghanistan.

After the New York Police Department was alerted to the possible threat, detectives reached out to Afzali to gather information about Zazi and two other men the imam knew from a Queens mosque, Adis Medunjanin and Zarein Ahmedzay. Authorities say the former high school classmates traveled together in 2008 to Pakistan, where Zazi received explosives training.

"I had known them when they were boys, and did not think they were capable of serious crime," Afzali said in court. "I thought perhaps they had fallen in with the wrong crowd."

The imam said he told Zazi "that law enforcement authorities had been to see me about him. ... I told Zazi, 'Don't get involved in Afghanistan garbage and Iraq garbage. That's my advice to you."'

At the time of the conversation, Zazi had already disposed of the bomb-making materials after a police stop on the way into the city. After the call from Afzali, he flew back to Colorado.

A few days later, under questioning by the FBI, Afzali said he panicked.

"I believed that the FBI was angry at me for calling Zazi," he said. "When I was asked whether I had told Zazi about law enforcement being interested in him, I lied and said I did not."

Medunjanin and Ahmedzay have pleaded not guilty to charges they sought to join Zazi in what prosecutors described as "three coordinated suicide bombing attacks" on Manhattan subway lines that were timed for one of three days after the eighth anniversary of the Sept. 11 terror attacks.

Prosecutors say the attacks were modeled after the July 2005 bombings on the London transit system. Four suicide bombers killed 52 people and themselves in an attack on three subway trains and a bus in London.