NEW YORK -- On a recent afternoon in a drab office near the banks of the Hudson River, a team of undercover investigators -- foreign-born and fluent in languages like Arabic and Farsi -- huddled in front of computers, hunting for extremists.
The New York Police Department officers surfed jihadist websites and chat rooms where suicide bombings and beheadings are celebrated, and hatred of the West rages. Their assignment: Pose as Islamic extremists, locate and engage real ones, then extract any shred of information about possible terrorist threats against the city.
''We're doing this from our hearts," said one detective from Egypt who, along with the other undercover officers, insisted on anonymity, fearing reprisals against family members in the Middle East.
The investigative unit was formed after the 2001 terrorist attacks -- part of the NYPD's strategy for homeland security that has resulted in the redeployment of about 1,000 officers to counterterrorism duty, including some posted in major cities overseas such as London.
The cybersleuths' Middle Eastern or central Asian origins also reflect an effort by the 37,000-officer department, the nation's largest, to take advantage of its linguistic diversity.
Spanish and Italian speakers abound on the force. But after Sept. 11, the NYPD identified more than 450 officers and civilian employees who speak about three dozen other languages, and groomed some for special assignments.
The NYPD maintains that using Middle Eastern officers in its cyber unit provides an early warning system for a city considered atop the terrorist hit list. And the focus on language expertise separates the NYPD from many other big-city departments.
Spokesmen at several Florida law enforcement agencies, including the Miami-Dade Police Department, said they make no special effort to develop Arabic speakers, and the Los Angeles Police Department calls language-services companies when it needs interpreters.
In southeastern Michigan, home to an Arab-American community of about 300,000, budget cuts have forced the Detroit Police Department to stop recruiting officers for the moment.
Even the FBI has grappled with a shortage of foreign language speakers, especially Arabic: The Justice Department's internal watchdog said last month that the bureau's backlog of untranslated audio recordings from terrorism and espionage investigations had ballooned to 707,742 hours at the end of March.
The NYPD has even loaned 17 officers to the Defense Intelligence Agency to help translate sensitive documents, including some recovered in Afghanistan, police officials said.
The officers, who were given special security clearances, gained ''invaluable experience in dealing directly with material from the enemy who destroyed the World Trade Center . . . and who continue to target New York City," said Police Commissioner Raymond Kelly.
In another case, Farsi-speaking officers helped question two security guards at Iran's UN mission who were spotted videotaping a subway station and other ''sensitive" sites around the city. The guards were later expelled from the country.
Some of the men in the city's antiterrorism group voluntarily traded in their nightsticks for laptops.
But others, like a 42-year-old Iranian immigrant, were drafted.
After spending 10 years patrolling the Bronx, the officer was ordered to join the Intelligence Division when his bosses learned he spoke Farsi.
He spent the first few months as an interpreter for FBI agents hunting terror suspects before his beat -- reluctantly -- became the Internet.
''I'm still a cop," he said. ''I want to be out on the street."
Still, the detectives take pride in their ability to tell the difference between a serious terrorist and a hoaxer.
As the Egyptian investigator put it: ''These are our mother tongues. You can't fool us."