BEVERLY, Mass. (AP) — A Massachusetts district attorney says an off-duty sergeant shot a police officer from a nearby town, then returned to the scene and killed himself as authorities closed in.

Essex District Attorney Jonathan Blodgett says Beverly Officer Jason Lantych was found shot multiple times Friday night in front of a Starbucks in Beverly. He says Lantych is in serious condition and undergoing surgery.

Blodgett says off-duty Hamilton police Sgt. Ken Nagy shot Lantych and fled. He says the 43-year-old Nagy returned to the Starbucks about five hours later and fatally shot himself in his car as officers approached him.

Blodgett’s office says Nagy and Lantych knew each other, but the motive for the shooting is unclear.

Beverly and Hamilton are towns about 5 miles apart in northeastern Massachusetts.