A fleeing gunman believed responsible for slaying a Massachusetts police officer early Sunday was killed while ambushing troopers from a closet, authorities said. Jorge Zambrano, 35, led cops on a manhunt for several hours Sunday after shooting Auburn police Officer Ronald Tarentino Jr., 42, to death at 12:30 a.m., police said at a press conference. The officer, a married father of three, was a two-year veteran of the force. He died at UMass Memorial Medical Center.

Neighbors on a suburban street where Tarentino was shot recall a driver fleeing after a rapid hail of gunfire.

“I heard rapid fire gunshots and somebody yell, ‘Get down!'” one neighbor, Phil Berthiaume, told the Boston Globe.”One police car after another…It was like bang, bang, bang, bang, bang, rapid fire, very loud.”

State and local law enforcement spent Sunday scouring Auburn, a city of 16,000 that is 40 miles west of Boston, to catch the killer.

The manhunt ended as Massachusetts troopers searched an Oxford duplex where the suspected killer managed to get inside his neighbor’s spare bedroom, according to the Worcester Telegram. Zambrano laid in wait, busting out of a closet, guns blazing, Col. Richard McKeon said at a press conference. He shot a trooper in the shoulder, but was killed as police returned gunfire.

“I think justice was served today,” McKeon said, noting Zambrano’s long history of breaking the law.

According to court records obtained by the Telegram, Zambrano was sentenced to two consecutive seven-year terms in 2011 for trafficking cocaine, two counts of assault, battery with a deadly weapon and assaulting an officer. It’s unclear when he was released, but the Telegram found a new string of arrests beginning in 2014.

Zambrano was in court as recently as Wednesday for an April arrest on suspicion of several traffic violations including driving with a suspended license. The initial arrest also included assault and battery on a police officer, but the case proceeded without a finding, the Telegram reported.

The trooper wounded while confronting Zambrano has been with the Massachusetts State Police for 18 years, and is expected to survive.

Tarentino’s body was brought to the state medical examiner’s office in Boston, escorted by a massive patrol of police cars.

He is the second police officer to die in the line of duty in Massachusetts this year. Trooper Thomas Clardy died on March 16 in a car accident.