When the Boston Police drug unit officers saw Grant Headley cruising down Mount Bowdoin Terrace on Friday morning, they suspected the convicted felon was selling drugs, police said later. They pulled him over and boxed him in.

But the 27-year-old, who was wanted for violating his probation, did not go quietly. Headley allegedly leapt from his car and opened fire, wounding a nine-year veteran in the leg and sparking a shootout, then taking off on foot before being tackled on Geneva Avenue, police said.

Thirteen preschoolers were just a few hundred yards away, out for a walk with their teachers.

Advertisement

“This individual had a dangerous path,” Boston Police Commissioner William B. Evans said at a press conference outside Boston Medical Center, where the injured officer was in the intensive care unit. “He didn’t want to go back to jail.”

Get Metro Headlines in your inbox: The 10 top local news stories from metro Boston and around New England delivered daily. Sign Up Thank you for signing up! Sign up for more newsletters here

The officer, whom the Globe is not yet identifying because his mother has not been told of his injury, is expected to survive. He is a 37-year-old father of two who was less than a week away from receiving a commendation for bravery when he was shot.

Boston Police Department Booking shot of Grant Headley.

Headley, whose adult criminal record dates back more than a decade and includes convictions for gun and drug charges, was released most recently from prison last April after serving five years on a host of gun charges, including being an armed career criminal in possession of a firearm without a firearm identification card.

On Friday, probation officers had a warrant for his arrest on charges related to violating his probation, though the nature of the violation was not immediately clear.

Evans said at the press conference that Headley was driving with a suspended license when drug unit officers stopped him.

Advertisement

Headley is in custody pending his arraignment, which is set for Monday in Dorchester Municipal Court.

Headley is being charged as an armed career criminal with a spate of charges, including assault and battery by means of a dangerous weapon and being armed while in the commission of a felony. He was not injured during his arrest, police said.

Court documents list Headley as an alleged member of the Greenwood Street Posse gang, and an official said his nickname is “Young Gunna.” Relatives either could not be reached or declined to comment.

Evans called the shooting “unprovoked.” It occurred around 10:20 a.m. on Mount Bowdoin Terrace, which residents described as a mostly quiet street filled with longtime residents but one that has been troubled in recent months by drug problems and absent landlords.

Police officers who stopped his car had not even unholstered their weapons when Headley allegedly began firing, Evans said. Witnesses described hearing about five or six gunshots, close together. Gary Bell said the shots were so loud, he thought they were being fired in his backyard. When he looked out his window, he saw a man in blue jeans and a brown jacket racing down Mount Bowdoin Terrace, police officers behind him shouting “Police!” and “Stop!”

Advertisement

One of the officers, he said, stopped running and leaned against a car, blood pouring from his leg.

A sudden, dramatic burst of chatter broke out on police radio at the time of the shooting, with officers reporting “shots fired,” and “officer shot,” according to audio archived by broadcastify.com.

About a minute in, the apparent voice of the wounded officer can be heard: “I am at 33 Mount Bowdoin Terrace. Shot.”

“OK, sir, help is on the way,” replies the dispatcher. “Help is on the way.”

A neighbor said it “happened so quickly.”

“I heard the shots and then police started chasing somebody,” said the man, who lives adjacent to the site of the shooting and spoke on condition of anonymity for fear of retaliation. “The police officer was on his back on the ground.”

Evans said officers at the scene shot back at Headley but did not hit him. The wounded officer tried to put a tourniquet around his leg, and another officer helped him. Evans said the quick application of the tourniquet might have saved the officer’s life.

Police chased Headley on foot across backyards on Rosseter Street, then onto Geneva Avenue, where he was wrestled to the ground and arrested without any more shots being fired.

Officers recovered a .40 millimeter semiautomatic Glock handgun at the scene, officials said.

“It’s a high-velocity handgun,” Evans said.

Mayor Martin J. Walsh, who visited the officer at the hospital with Evans, lauded the Boston police, whom he called “the best in the nation.”

“I commend the officers for their incredible restraint,” Walsh said.

The wounded officer is expected to recover from his injuries, officials said. Reporters who saw him entering the hospital said he was sitting up and alert when he arrived, and officials who spoke with him said he was conscious, and they thanked him for his service.

“In our mind, he’s a hero,” Evans said. “He’s out there doing God’s work.”

The officer was slated to be awarded a Commissioner’s Commendation on Thursday, along with three other officers, officials said, for bravery in handling a shooting in December. He was with three other drug unit members Dec. 15 on Brinsley Street when they saw a young man draw a firearm, chamber a round, and hand the gun to a companion. As the officers moved in, shots rang out, and the men attempted to flee. Police arrested three people at the scene and later at the hospital.

Craig F. Walker/Globe staff Authorities investigated the crime scene on Rosseter Street after a Boston police officer was shot in the leg Friday morning.

Patrick Rose, president of the Boston Police Patrolmen’s Association, said in an interview that the officer had been a patrolman in Mattapan for seven years before moving to the drug unit in the same neighborhood. He has an exemplary reputation, Rose said.

“He’s very proactive, highly decorated. He’s a good guy. And that’s the best compliment a cop can give a cop,” Rose said.

The officer, who is from South Boston, is married and has two young children, Rose said. His mother recently underwent open heart surgery, Rose added. His wife and uncle were by his side at BMC Friday after the shooting.

Rose lashed out at Headley, saying he carried a gruesome nickname and a long violent history.

“His name, for crying out loud, is ‘Young Gunna,’ ” Rose said. “He was investigated for homicide. He is somebody who should not be out on the street.”

In the hospital press conference earlier in the day, Rose lamented the wide availability of guns on the streets and the dangers that officers face daily. Last March, Officer John Moynihan was shot in the face by a violent criminal whom police shot to death; Moynihan survived. Rose noted the Philadelphia police officer who was ambushed, shot, and wounded Thursday.

“There are far too many guns on the streets. The officers in the city of Boston do an excellent job collecting them, arresting people with those guns,” Rose said. “Bottom line is, though, we are the targets. And that’s wrong. We are the men and women protecting you in this city.”

Eric Moskowitz

, Travis Andersen, and Martin Finucane of the Globe Staff contributed to this report. Evan Allen can be reached at evan.allen@globe.com . John R. Ellement can be reached at ellement@globe.com Meghan E. Irons can be reached at meghan.irons@globe.com