“Nothing from there yet,” Cohen said. But the many N.Y.P.D. officers who have been to Iraq with the National Guard or with the Reserves are debriefed upon their return. Cohen turned and stared at the map. “I have to assume it’s going to come out bad,” he said.

One morning, I met Detective Charles Enright and his partner, Sergeant Joseph Salzone, at the Peninsula hotel, in midtown. Enright and Salzone work for Cohen on Operation Nexus, the program that tracks terror-sensitive businesses. Nexus squads visit about two hundred business concerns a week. Since the program was launched, in 2002, they’ve been to more than twenty thousand. Jimmy Chin, the Peninsula’s regional director of risk management, was meeting with Enright and Salzone. The Nexus officers wore business suits, and had the intense but deferential air of high-end sales reps. Anyone writing a parking ticket would be more intimidating. They rely, essentially, on the public-spiritedness of businesspeople, whom they practically beg to alert them to anything suspicious.

Chin, who is also the chairman of the safety-and-security committee of the Hotel Association of New York City, said, “The N.Y.P.D. is a huge police department that acts like a small one. In other places I go, nobody can imagine the kind of tight relationship we have here. But we’ve really changed our thinking since 9/11. I wouldn’t have given these guys my cell number before. Now they’ve got to be able to reach me 24/7.”

“Most of these major hotels, they have garages, and that’s what we’re actually most worried about,” Salzone said.

I asked what would be of interest to them. “People who don’t want to give the garage the keys. Any vehicle that looks overloaded,” he said.

“Salvage yards—they’re traditionally Mob-related, so they get their guard up when we show up,” Enright said. “But we tell them it’s about terrorism, their guard comes down, they’re ready to help. They know we don’t want to look at their books. Other departments are going to bust their chops on that. We just want to know about any used emergency vehicles they’ve been selling.”

“Ambulances,” Salzone said. “Ambulances can get through checkpoints. In the Middle East, they’ve been filled with explosives. Boom.”

“Pat Wagner manages the Thirty-fourth Street heliport, has a lot of Jet A fuel,” Salzone said. “We talk to her a lot.”

After a Palestinian suicide bomber in Israel disguised himself as an ultra-Orthodox Jew, the Nexus teams visited religious-garb suppliers. When, in early 2003, an alleged plot to poison the London Underground with ricin was reported, Enright and Salzone headed to Manhattan’s diamond district, because acetone, which dealers use to process their stones, is used in the production of ricin. Castor beans are also required. To learn more about those, the Nexus teams visited horticulturalists and the Brooklyn Botanic Garden. (David Cohen told me proudly, “It’s been said, ‘Cohen knows where every castor bean in the city is!’ ”)

“Thing you’ve got to remember,” Salzone said. “We got a boss who doesn’t sleep.” He meant Cohen. “That percolates down to us.”

“9/11 is never over,” Enright said.

The officers wrapped up their business with Chin and left the Peninsula. A truck-rental place in Chelsea had a new manager they wanted to meet. She turned out to be a Trinidadian, young and friendly but very busy. She took business cards, murmuring “Terrorist Incident Prevention Unit” as she read, and eying Salzone and Enright. She took a Nexus information sheet, but was obviously eager to get back to work. Enright and Salzone headed for the door. Then the new manager said, “Wait. There was one fellow. A really strange guy.”

“Did he pay cash?”

“Yes.”

Enright and Salzone turned back. And so the manager told them a long story about a secretive, erratic, abusive customer. To me, he sounded extremely suspicious. I was riveted. Enright and Salzone were not. They thanked the manager for her time, and left.

Once we were back on the street, they gently explained to me that the man was just a bad truck-rental customer. Every truck-rental place had them. Yes, this guy had paid cash, but nothing else the manager said tripped any alarms. Then I realized why he had sounded so suspicious to me. Her manner, the sequence, even the rhythm of the conversation—“Wait, there was one fellow”—followed, to the letter, every script of every cop show ever made.

Enright seemed to read my mind. “All these duped-up cop cars they’re using on these TV shows,” he said. He was pointing along the West Side Highway. “ ‘Law & Order’—they shoot right over here. Those cars are all unsecured at night, so we visit them.”

The intelligence division doesn’t gather information only from the street. It has specialists tracking suspicious financial movements and others working the jails and prisons; in unmarked buildings throughout the boroughs, it has officers fluent in the relevant languages poring over the foreign press or surfing the innumerable jihadist Web sites and chat rooms. The N.Y.P.D. employment application form these days asks about knowledge of some sixty languages. The department has had considerably more success in attracting immigrants who can pass its careful background checks than either the F.B.I. or the C.I.A. has had. In a nation that, in 2002, conferred a total of six undergraduate degrees in Arabic, even the Pentagon, not known for its humility, recognizes this rare resource. The Department of Defense recently borrowed seventeen computer-literate Arabic speakers from the N.Y.P.D. to assist its intelligence arm. At one counterterrorism-bureau facility, in a darkened room full of cops wearing headphones and silently watching satellite broadcasts on big flat-screen TVs, I met a tall, gaunt officer, whom I’ll call Mohamed, taking notes on news reports from Pakistan. Mohamed grew up south of Kabul, speaking Dari. He also understands Pashto, Farsi, and Arabic. He joined the N.Y.P.D. in 1994, and was issuing parking tickets when the counterterrorism bureau found him, in 2002.

On another occasion, David Cohen introduced me to some of the N.Y.P.D.’s cyberintelligence specialists: a detective and a sergeant, both born and reared in Egypt, and a detective born and reared in Iran. “When we started, in 2002, we didn’t really know what we were doing,” Reza, the Iranian-born officer, said. “It was trial and error. Viruses beyond belief. But we got the medicine now. We go into the worst chat rooms.”

“We’re always being tested,” Maged, the detective from Egypt, said. “You know you passed the test when suddenly somebody gives you a password to a chat room you didn’t know existed.” He went on, “We’re familiar with the tradition, the background, we speak the slang.”

“Also, we’re cops,” Reza said. “We hear different things than the civilians the F.B.I. hires do. We got investigative backgrounds, looking for bad guys on the street. Sometimes it’s not what they’re saying, it’s what they’re not saying. You see patterns, like news items from two months before that suddenly start recirculating.”

Sometimes, Reza said, “You’ll see an offer of a video-clip download. It might be a beheading, or training materials, or proof that someone actually did something.”

Aly, the Egyptian-born sergeant, shook his head. “This is not Islam,” he said.

The cybercops told me that each of them belonged to more than thirty separate e-mail groups, or chat rooms.

“It can take a long time to work your way up the ladder,” Maged said. “At first, it might be just some guy in Texas talking with some guy from Saudi, anti-government shit. But other people are listening, and if they see you coming back every day, and you seem serious, they might invite you somewhere else.”

“Ninety-seven per cent of the juicy stuff is done P.M.—personal message,” Reza said. “Not in chat rooms. But it takes a lot of time—months, maybe years—to get this kind of trust.”

I asked the cybercops how they communicated with other security services.

“We tell the Commissioner,” Reza said, indicating Cohen. “He tells the C.I.A.”

“Or I call Kelly, depending what it is,” Cohen said. “And he takes our calls.”

Detective Ira Greenberg, the N.Y.P.D.’s man in Scotland Yard, was on the Tube, on his way to work, when the London bombs went off. As soon as he could reach the street, he started phoning in reports to the intelligence division. Kelly was awakened by a call at home. He ordered the entire department’s midnight-to-eight shift to stay on duty through the day, and posted an officer in every subway train during rush hour. Four detectives—two from intel, two from counterterrorism—left for London. The N.Y.P.D.’s response was similar on the day of the Madrid train bombings, last year. Cohen told me, “I got a call”—from Washington—“saying, ‘Don’t send anybody.’ I said, ‘They’re already on the plane.’ ” He went on, “They were the first foreign law enforcement on the scene with access. They were welcomed. They weren’t over there investigating. That’s someone else’s job. We’re just trying to understand, so as to increase protection here.” After learning that the Madrid train bombers parked their van a few blocks from the station, and carried their bombs by hand to the trains, the department ordered that the security perimeter around subway and commuter-train stations in New York be expanded by two blocks. The revelation that a small businessman saw the Madrid terrorists’ preparations but figured that it was just a petty crime in progress and didn’t bother calling the cops was seen as a reason to redouble Nexus, so that no New York shop owner will ever be that blasé.

The London bombings reminded me of something Sheehan had said: “Your greatest fear is that they’re out there below the horizon.” Unlike the Madrid bombers, the young jihadists who killed more than fifty people this month were not, it seems, even on the radar of the local police. British security has disrupted a number of serious plots in recent years, but its intelligence failed utterly this time. As the I.R.A. once darkly observed, after a botched attempt to assassinate Margaret Thatcher, “We only have to be lucky once; you will have to be lucky always.” Subway systems, moreover, are hugely vulnerable. Cohen’s undercover agents spent more than a year tracking a young Pakistani immigrant named Shahwar Matin Siraj, who, according to the police, enlisted an angry teen-ager from Staten Island named James Elshafay in a plot to bomb the Thirty-fourth Street/Herald Square subway station. Investigators never found a connection between the pair and any organization, but, according to the police, Siraj and Elshafay drew up detailed attack plans. Cohen’s informant was by then wearing a wire and, last August, the men were arrested. “Lone wolves,” Cohen said. “Homegrown, but inspired globally.”

What the N.Y.P.D. learns from London’s tragedy will flow from the investigation now under way. In the subways, more closed-circuit cameras and more—not fewer—station attendants would seem to be indicated. Hasty reactions are not always helpful. On the day of the London blasts, the Metropolitan Transportation Authority, which operates the Brooklyn Battery and Queens Midtown tunnels, and the Port Authority of New York and New Jersey, which operates the Lincoln and Holland tunnels, disconnected cell-phone service in the tunnels, calling it a counterterror measure. The measure’s logic was unclear. The Post quoted a Port Authority official as saying that the N.Y.P.D. had requested the cutoff. But an N.Y.P.D. spokesman told me, with some frustration, that the department had made no such request. Michael Sheehan, Kelly’s counterterrorism deputy, was closely monitoring events in London—his and Cohen’s officers are embedded in the investigation there—but he had not yet seen anything that would, he told me, “change how I deploy here.” Public fears of a possible follow-up attack rose and fell—“fiends poised to strike again,” the Post opined—but Sheehan seemed calm. “We’re on high alert,” he said. “They’re not going to attack you when you’re on high alert.”

“Our backbone is hard-nosed detective work, investigations,” Sheehan told me. And yet there is not much about his job that resembles traditional police work. He worries about infrastructure protection—roadways, financial systems, the water supply. He works on grim, multi-agency protocols for identifying and responding to chemical, biological, radiological, or nuclear (C.B.R.N.) attacks. He supervises constant, intensive training—his bureau trains city, state, federal, and regional instructors, and also key corporate security divisions. “We train the trainers,” Sheehan says.

Sheehan, like Cohen, has been thinking hard about Al Qaeda for a long time. He was in Somalia in the early nineties, when Al Qaeda trained and supplied local militiamen who attacked American peacekeepers. By the time he retired from Special Forces, as a lieutenant colonel, in 1997—having completed two tours with the National Security Council, at the White House—Sheehan had developed what “The 9/11 Commission Report” describes as an “obsession with terrorism.” He became the State Department’s coördinator for counterterrorism in 1998, but was frustrated by the cautiousness of American efforts to oppose Al Qaeda. Sheehan told the 9/11 Commission that he felt he was regarded as “a one-note Johnny nutcase.”

Richard Clarke, the N.S.C.’s coördinator for counterterrrorism, in his book “Against All Enemies,” describes Sheehan’s fury after one White House meeting, in 2000: “ ‘What’s it going to take, Dick?’ Sheehan demanded. . . . ‘Does Al Qaeda have to attack the Pentagon to get their attention?’ ”

Sheehan says that, even when he was at the State Department, he was often in New York. “Most of the real Al Qaeda expertise in this country was always here in New York,” he told me. John O’Neill, of the F.B.I., was the head of the local Joint Terrorism Task Force then. O’Neill was as prescient about Al Qaeda as Sheehan and Clarke were, and at least as frustrated. O’Neill quit the F.B.I. in 2001, became security director of the World Trade Center, and a few weeks later was killed in the terror attacks.

So Sheehan took the counterterrorism job at the N.Y.P.D. with a full appreciation of the federal government’s failings. Kelly knew Sheehan from his stint in Haiti, where Sheehan was the American liaison to the international forces. When Kelly approached him about the New York job, Sheehan was serving as the U.N.’s Assistant Secretary-General for Peacekeeping. “He didn’t have to talk me into it,” Sheehan said. “I wanted to get back into counterterrorism.”

What’s striking about Sheehan is how casually he connects his unusual breadth of experience to his present job. He directs close studies of far-flung terrorist episodes and groups, on the theory that, as he put it, “We have to know what’s going on. When things went to hell in Egypt in 1990, it showed up here.” Among other things, he was referring to the fact that Sheikh Omar Abdel Rahman, the leader of the foiled 1993 “landmarks” bomb plot against major New York buildings and tunnels, came to the United States in 1990, having escaped a brutal crackdown on Islamists.

As closely as Sheehan watches developments in Yemen and the Philippines, most of his work is profoundly local. It is basically civil defense, retooled for the age of terror. His conversation is full of “bomb curtains” (an Israeli invention, made of Kevlar—all vulnerable commercial windows should have them) and “clamshell” road barriers (also known as Delta barriers, a design refined by the N.Y.P.D.) and “standoff” (an area around targets, particularly buildings, not accessible to vehicles).

It was Sheehan who, in a letter to the Port Authority last year, raised the N.Y.P.D.’s concerns about the design of the Freedom Tower, at Ground Zero. The standoff was inadequate, Sheehan said, and there was too much glass near the ground. Kelly backed Sheehan, Mayor Bloomberg backed Kelly, and the plans for the site were eventually redrawn.

Sheehan stared ruefully at the papers on his desk, and pushed away the remains of a takeout lunch. He has a restless, loose-limbed energy; in a dark suit, carelessly worn, with his caustic asides and wide knowledge, he seems more like a professor than like a career soldier, or a top police official. “You’ve got to find a level of intensity you can sustain,” he said quietly. “If we let ourselves get all spun up by every bullshit threat we get from Washington—and not sleep for three nights, then sleep for two days—something real will happen during those two days.”

The threat reports from Washington were incessant, he said. “A lot of stuff originates overseas, probably from some jerkoff teen-ager. We get it from C.I.A., F.B.I., and I’m glad they pass it to us, but the first thing we ask is ‘What’s the source?’ Our hot line, which gets a lot of calls, somebody answers and asks for a name and address. So we get very little b.s.” (The hot-line number is 888-NYC-SAFE. It can also be reached through 311. All the signs in the subways and at bus stops—“If You See Something, Say Something”—point to the hot line.)

Sheehan, as an outsider to local institutions, seems to have a relatively easy time forming unheard-of alliances with other city agencies. He even claims to welcome the N.Y.P.D.’s traditional rivalry with the Fire Department. “They’re both aggressive organizations, and that’s fine,” he said. In April, the Mayor signed a formal order designating the Police Department the lead agency in hazardous-materials incidents, which had previously been handled by the Fire Department with the police in a subordinate role—and the F.D.N.Y., naturally, objected. In other American cities, fire departments still have the command role in hazmat incidents. But New York City is at an exceptionally high risk for a C.B.R.N. attack, and that has caused the city to revise the traditional approach.

Assistant Chief Phil T. Pulaski, a commanding officer in the counterterrorism bureau, gave me an example: “A tanker-truck collision, a spill, it’s an accident anywhere in the country, but not here in New York City. Our intel shows that Al Qaeda’s instructions to its people are ‘Get your hazmat license, get your tanker-truck license, and we will use them as weapons.’ So any tanker spill here is presumed to be criminal in nature, and it’s investigated as such until proved otherwise. Why? Because if the scene is just cleaned up as fast as possible, we may miss the evidence of a terror crime in progress. The driver may get away. Even if he’s killed, we want to go through his pocket litter, find out who he’s meeting. We want to prevent the next incident.”

Much of the counterterrorism bureau’s work is done at a facility in an obscure warehouse district in Coney Island. Like other nodes on the N.Y.P.D.’s antiterror grid, it has a slightly “X-Files” feel. There’s no sign on the building; if you don’t know where to look, you probably won’t find it. Pass through the solidly built, monitored, and remote-controlled door, however, and you’re in a bustling, gleaming, windowless, oddly cosmopolitan world. There are classrooms, meeting rooms, lots of cops (uniformed and plainclothes), a little cafeteria, a library. On one wall is a big framed black-and-white photograph—an aerial shot, taken at night—of the twin towers, looking intensely romantic.

“We collect information on the strategic threat, including from overseas, and analyze it,” Captain Hugh O’Rourke told me. “Then we take it out and put it to work: target hardening.”

We were joined by Lieutenant John Rowland, the director of regional training for the bureau. “We’ve been doing instruction on Islam for the N.Y.P.D.,” Rowland said. “It’s needed. We’ve got a lot of Catholics in this department.” (I had already noted, in a restroom at the facility, a well-thumbed copy of “The Complete Idiot’s Guide to Understanding Islam.”)

O’Rourke said, “We’re trying to get our analysis influenced with the proper cultural perspective, because we’re a long way from southwest Asia. Some of our officers were born there, though.”

“Pashtun tribesmen, Pakistanis, Egyptians, Farsi-speakers, Filipinos, Chinese—you name it,” Rowland said. “They’ve been tremendously helpful. One guy here just made his hajj.”

The N.Y.P.D.’s contingency planning now includes the devolution of decision-making, in an emergency, from One Police Plaza to eight borough command posts around the city. This system got an unplanned tryout during the big summer power failure in 2003. It passed that test. I visited a facility known as the “shadow command center,” which will replace N.Y.P.D. headquarters if One Police Plaza becomes disabled. It’s in an even more obscure spot than the Coney Island center, and it sees very little telltale traffic in and out. Vast rooms full of desks, phones, and silent monitors stretched around us, inside a huge windowless warehouse. It’s designed to be up and running in an hour.

I went out to Floyd Bennett Field, the old airbase on Jamaica Bay, to watch some N.Y.P.D. training exercises. There were “fast rope” helicopter maneuvers: officers zipped down ropes from choppers hovering thirty or forty feet above the ground; they hit the dirt, rolled, and sprinted to positions, under the beady eyes of trainers with stopwatches. Charles Kammerdener, the commanding officer of the special-operations division, met me in his office. He was white-haired, almost naval-looking. “In the old days, it was basically a perp in a building in a tactical situation,” he said. “ ‘Thank you. Do it over.’ That was then. Nowadays, we train for people who may be military-trained, booby-trapped, automatic-armed, working multiply.”