A member of the film crew rushed over to the massive storefront window, glaring into the street searching for the misguided extra. “He’s someone who will never be in the shot again,” the crewman assured the visibly frustrated Mr. Fuqua, who was rubbing the back of his bald head.

A few seconds later Mr. Gere staggered in from the sidewalk, nursing his elbow as he joined Mr. Fuqua to review tape of the scene. Then before long there was silence, and then “Action!” And again Mr. Gere was in the street, in the middle of the block, tussling with an actor probably half his age.

As strange a scene as it was that day in a neighborhood more accustomed to real-life drama, even more extraordinary is the story of how Mr. Martin, a 28-year-old former subway worker from East New York, Brooklyn, came to write “Brooklyn’s Finest,” a gritty thriller starring Don Cheadle, Ethan Hawke and Mr. Gere as police officers in a housing project. Mr. Martin, who in his dusty white FUBU sneakers, denim shorts and a short-sleeve, button-up shirt looked that day more like a college senior than a Hollywood writer, is a onetime film student who remains a few credits shy of his degree from Brooklyn College. His most recent job was subway flagger with the Metropolitan Transportation Authority; he waved flags and set up warning lights in subway tunnels to warn approaching trains that construction crews were working on the tracks.

Image Ethan Hawke as a police officer in "Brooklyn's Finest." Credit... Phil Caruso/Overture Films

The whole movie thing, he said, happened sort of by chance.

In 2005 a car accident left him injured and his 1991 Lincoln Mark VII totaled. While he would need three months of physical therapy to deal with a bulging disc in his back, his obsession focused less on mending than on making some extra cash to buy a new car. Surfing the Web one day he came across a call for submissions in a screenwriting competition. The grand prize was $10,000. So he began to write the first scenes of what he called “kind of an epic”: the intertweaving stories of three police officers who have misplaced their moral compasses and grown to hate themselves a little along the way.