New York police arrested a man trying to build a pipe bomb with instructions from an al-Qaida magazine that he planned to use against soldiers returning from Iraq and Afghanistan, US media have reported.

The suspect, identified in court documents as 27-year-old Jose Pimentel, a US citizen originally from the Dominican Republic, was charged with three terrorism-related offences and two other counts, court documents said. Among his other alleged targets were police officers and post offices.

Pimentel got instructions on building a pipe bomb from Inspire, a English-language online magazine published by al-Qaida in the Arabian peninsula, CNN reported.

The news channel claimed that Pimentel was caught drilling into a pipe in his mother's New York flat after having been under surveillance by police for more than two years.

In an interview with, Pimentel admitted he "took active steps to build the bomb, including shaving the match heads and drilling holes in the pipes" and was "one hour away from completing it," the court documents said.

New York's mayor, Michael Bloomberg, said at a press conference: "This is a city that people would want to take away our freedoms gravitate to and focus on."

The New York Times quoted one police officer as saying it was a 'lone wolf scenario.