A Queens imam who became entangled in a terrorism plot against New York City when he warned one of the planners that he was under government surveillance pleaded guilty on Thursday to a reduced charge of lying to federal officials.

Fighting through tears, the imam, Ahmad Wais Afzali, spoke of failing his adopted country, a country his conviction will soon require him to leave, maintaining that he had no idea of the seriousness of the case when he told Najibullah Zazi in phone conversations that law enforcement officials were investigating him.

Mr. Afzali, who had been approached by the New York Police Department to provide information on Mr. Zazi, said he was afraid when Federal Bureau of Investigation agents interrogated him two days later — so he lied about the conversation with Mr. Zazi, even though he knew it had been recorded.

“My intention was not to protect Zazi but to protect myself,” he said during a hearing on Thursday in United States District Court in Brooklyn. “In doing so, I failed to live up to my obligation to this country, my community, my family and my religion. I am truly sorry.”