A man in eastern Massachusetts attacked a police officer, then grabbed the officer's gun and fatally shot himself in front of the city hall, police said.

Police spokesman Lt. William Sharpe said that at about 10 a.m., the young man, whose identity was not released, approached the Lynn police officer from behind while he was on a work detail and attacked him unprovoked.

"We don't believe he made any statements to the officer prior to the attack," Sharpe said.

A nearby utility worker intervened and while the three struggled, the suspect got hold of the officer's gun and shot himself, Sharpe said.

Patrolman Patrick McGuire received cuts and bruises during the scuffle and was treated at a local hospital, authorities said.

McGuire, a 16-year veteran, has been placed on paid administrative leave pending an investigation, said Carrie Kimball Monahan, a spokeswoman for the Essex District Attorney's office.

Lynn is about 10 miles north of Boston.