The case was “terror related” but there was no imminent threat because the suspect was under arrest, a law enforcement official said, declining to be identified before the official announcement at 7:30 p.m. (0030 GMT on Monday).

CNN said the man learned how to build a pipe bomb from the Al-Qaeda online magazine “Inspire” and planned to target soldiers returned from overseas, police and post offices.

The bomb would have worked if the suspect succeeded in assembling it properly, CNN said, citing unnamed sources.

The mayor’s office announced a joint news conference with Police Commissioner Raymond Kelly and District Attorney Cyrus Vance, the chief prosecutor for Manhattan.

Police had the man under surveillance for about a year, the Times said. The newspaper quoted one law enforcement official as saying it was a “lone wolf scenario,” meaning the suspect was believed to be acting on his own.

Since the Sept. 11 attacks by Al-Qaeda militants in 2001, New York City has considered itself a prime target and has developed extensive intelligence and counterterrorism divisions within the New York Police Department.