A man wielding an 11-inch meat cleaver near Pennsylvania Station and resisting police officers’ efforts to catch him on Thursday slashed an off-duty detective in the head before being shot by the police, the authorities said, in an episode that sent commuters and tourists fleeing during the evening rush.

It started when the police confronted a man who was trying to remove a “boot” device attached to a tire on his car, officials said, and escalated into a chaotic chase through Midtown Manhattan that ended with officers shooting at him 18 times.

The man, Akram Joudeh, 32, was critically injured and taken to Bellevue Hospital Center, the police said. The off-duty detective, identified by the police as Brian O’Donnell, was in serious condition. Two other officers were taken to the center with injuries that were not life-threatening.

The episode began around 5 p.m. at West 32nd Street and Broadway when several officers responded to a report that Mr. Joudeh was trying to remove the device, Police Commissioner William J. Bratton said at a news conference on Thursday night. The police said they believed Mr. Joudeh, whose last known residence was in Queens, was living out of his car.