The New York Police Department (NYPD) has tried to justify its spying on Muslims after being criticized of illegal espionage and religious profiling.